zizi21
asked on
pls help - declaring a register variable
hi,
i am trying to declare a register variable
register int a = (int *)malloc(z*sizeof(int));
the error that i get is register name not specified for a ..
i am trying to declare a register variable
register int a = (int *)malloc(z*sizeof(int));
the error that i get is register name not specified for a ..
Please provide the complete error message. Also it would be helpful to know why you want a pointer to be a register variable.
void function (void)
{
register int a;
for (a = 0; a < 10;a++)
{
printf ("%d", a); \\ Prints numbers 0 to 9
}
}
{
register int a;
for (a = 0; a < 10;a++)
{
printf ("%d", a); \\ Prints numbers 0 to 9
}
}
if you are type casting to int* then you need to write like this:
register int* a = (int*)malloc(z*sizeof(int)
else
register int a = malloc(z*sizeof(int));
Hope these link will clear your doubts:
http://geeksforgeeks.org/?p=4346
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.