The following assignment is giving compilation error(expected identifier)
int a = 1,2,3;
But the following is assigning a to 1.
int a;
a = 1,2,3;
Can you help to understand.
Type: Posts; User: krkr
The following assignment is giving compilation error(expected identifier)
int a = 1,2,3;
But the following is assigning a to 1.
int a;
a = 1,2,3;
Can you help to understand.
>> Sometimes this has some use when the left operand has a side effect, but in this case it doesn't so there's no point.
Can you please provide an example for the "," usage when the left operand has...
>> Sometimes this has some use when the left operand has a side effect, but in this case it doesn't so there's no point.
Can you please provide an example for the "," usage when the left operand...
I have tried the following program and I am getting output as a:1 b:3. Can someone help me to understand why this behaviour.
int main()
{
int a = 1;2;3;
int b = (1,2,3);
...
I got a doubt, what will happen if we assign a char variable without single quotes. So replaced c = '0x0A' with c=0x0A and printed using %c, I am getting junk value "▒" always. Tried replacing 0x0A...
What is the difference between storing '0xAA' and '\xAA' in char.
My understanding about '0xAA' is, the ASCII value will be stored in memory. But my doubt is, why it prints only 41 during printf,...
In the following program I am trying to left shift a char variable.
int main()
{
unsigned char c='0x0A';
printf("%c", (c << 4));
return 0;
}
So r9 register will act as a pointer, what ever value we assign to ptr will be stored in r9 register.
What exactly the following declaration will do?
register int *ptr asm ("r9");
(OR)
It seems when we give within single quotes then it is taking it as a "ascii character", otherwise it is treating it as "ascii value" in decimal.
But if we give more than 9 in single quotes then...
Can you help to understand what will store in "value" variable in the following two cases. When we assign a character then ascii value will be stored, but if we assign value (sat 0 ,1 etc) then what...
Thanks for the reply.
So we can't initialize a double pointers?
Can you guide to understand the usage of double pointers.
Is there any difference between the following two initializations.
case1)char **ch = {"abc","def"};
case2)char *ch[] = {"abc","def"};
I don't have control on the get_value(). It is a generic function which returns the value of bits at the given bit positions.
It seems the enum constants are signed int as per C standard, please correct me if it is different.
Is there anyway to define an enum and typecast to other type say "unsigned int"?
In the...
I couldn't understand
Can you please elaborate a bit.
As per my understanding following is the syntax for function pointer using typedef.
typedef void (*fp)(int arg);
I saw typedef to function definition similar to below.
Thanks for the info.
Thanks for pointing to the post. It explains about tentative definition of object with file scope.
Will the tentative definitions not applicable to an object with local/block scope and static...
If we declare a global variable multiple times as shown below then it is not giving any issue.
int i;
int main()
{
printf("%d \n",i);
return 0;
}
I have declared a pointer to const char and incremented the pointer, it is not giving any issue.
int main()
{
const char * ptr;
char *c = "ABC";
ptr = c;
ptr++;
Thanks very much for the information.
Hi,
This is not homework, I found this initialization in the clock configuration source.
I have tried with the following sample program also, it is not giving any syntax error.
#include...
I come across following initialization in some of the sopurce files.
static const char const *p[] = {"ABC","DEF",} ;
As per my understanding ...
char *p ----> p is...
If function name is not conatant then following program should throw error, because initializers should be constants for static objects. But it is compiling successfully.
struct ex {
...