***Damn, update**** I figured it out. I needed to declare the int values separately. I don't know why I couldn't do it like I did below, but declaring them separately worked. Sorry!!!!!
Hello! After taking the weekend off, due to work, sick, and needing to recharge the batteries after 4 straight chapters of learning to program, it's time to get going again. Anyway, my book asked me to show the output produced by each of the following code fragments, assume that i, j, and k are into variables.
Did I do something wrong? Or do I need to enable nested functions? I've seen the nested functions error before, but it was because I made an error in my code, not because I needed to use nested functions.
answer to below question is 63 8 By the way, I can do this in my head, but my compiler cannot!!
Question 1:
i = 7; j = 8;
i *= j +1 ;
printf ("%d %d", i, j) ;
My code as follows, typed exactly as in the book....
Output
Users/scottdean/documents/fragment.c: In function ‘main’:
/Users/scottdean/documents/fragment.c:7: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/scottdean/documents/fragment.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*=’ token
/Users/scottdean/documents/fragment.c:7: error: expected expression before ‘*=’ token
Hello! After taking the weekend off, due to work, sick, and needing to recharge the batteries after 4 straight chapters of learning to program, it's time to get going again. Anyway, my book asked me to show the output produced by each of the following code fragments, assume that i, j, and k are into variables.
Did I do something wrong? Or do I need to enable nested functions? I've seen the nested functions error before, but it was because I made an error in my code, not because I needed to use nested functions.
answer to below question is 63 8 By the way, I can do this in my head, but my compiler cannot!!
Question 1:
i = 7; j = 8;
i *= j +1 ;
printf ("%d %d", i, j) ;
My code as follows, typed exactly as in the book....
Code:
#include <stdio.h>
main ()
{
int i = 7 ;
int j = 8 ;
int i *= j + 1 ;
printf ("%d %d", i, j) ;
return 0 ;
}
Output
Users/scottdean/documents/fragment.c: In function ‘main’:
/Users/scottdean/documents/fragment.c:7: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/scottdean/documents/fragment.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*=’ token
/Users/scottdean/documents/fragment.c:7: error: expected expression before ‘*=’ token
Last edited: