Page 1 of 1

program problem

PostPosted: Sun Mar 04, 2007 2:54 am
by Caaz Games
Code: Select all
 #include <stdio.h>

 

main(){

int x = 9;

int size;

size = sizeof(x);

printf(“The size of x is %d bytes.\n”, size);

}

when this program runs it's supposed to type the words "the size of x is 4 bytes.but it doesn't work, why is that?

PostPosted: Sun Mar 04, 2007 1:32 pm
by makslane
The include directive is not supported.
The printf function is not supported.

Use the sprintf function to put the text in a text actor, like this:

Code: Select all
int x1 = 9;
int size;
size = sizeof(x1);

sprintf(text,“"The size of x is %d bytes."”, size);

PostPosted: Sun Mar 04, 2007 4:19 pm
by Caaz Games
Oh, ok Thanks!