c - What is the argument for printf that formats a long?

c - What is the argument for printf that formats a long?

The printf function takes an argument type, such as %d or %i for a signed int. However, I don't see anything for a long value.…


c++ - What is a variable's linkage and storage specifier?

When someone talks about a variables storage class specifier, what are they talking about? They also often talk about variable linkage in the same context, what is that?…


c++ - Cross platform format string for variables of type size_t?

On a cross platform c/c++ project(Win32, Linux, OSX), I need to use the*printf functions to print some variables of type size_t. In some environments size_t's are 8 bytes and on others they are 4.…


Parsing input with scanf in C

I've been having a lot of problems trying to figure out how to use scanf(). It seems to work fine with integers, being fairly straight forward scanf("%d", &i). Where I am running into issues is usin…


Private and Protected Members:C++

Can someone enlighten me as to the difference between private and protected members in classes? I understand from best practice conventions that variables and functions which are not called outside th…


c++ - cout Formatting

I'm pretty sure this is a simple question in regards to formatting but here's what I want to accomplish: I want to output data onto the screen using cout. I want to output this in the form of a tabl…



sprintf in C#?

Is there something similar to sprintf() in C#? I would for instance like to convert an integer to a 2-byte byte-array. Something like: int number=17; byte[] s=sprintf("%2c", number);…


powershell:how to format get-date to string and remove 0's?

I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: $filedate=get-date-uformat "%m-%d-%Y" $filedate=$filedate.ToString().Replace("0", ""…


What is the use of package level protection in java?

I know how package level protection in java works. I read a lot of code(including lots of open source stuff) and no-one seem to be using it. The whole protection level seems slightly faulty to me(I…


Behaviour of printf when printing a %d without supplying variable name

I've just encountered a weird problem, I'm trying to printf an integer variable, but I forgot to specify the variable name, i.e. printf("%d"); instead of printf("%d", integerName); Surprisingly the p…




format string printf with example access java double specifier private