View previous topic :: View next topic |
Author |
Message |
Krloz Grandmaster Cheater Reputation: 0
Joined: 25 May 2006 Posts: 525 Location: Mexic00l
|
Posted: Sun Apr 29, 2007 2:59 pm Post subject: Whats wrong in this code? :P |
|
|
It just crashes when I try to print variable Nombre
Code: | #include <stdio.h>
#include <stdlib.h>
int main()
{
int nombre;
//int edad;
//int ano;
printf( "Que pedo wey\n");
printf( "Este es uno de mis primeros programas asique esta un poco pedorrilo\n");
printf( "Dime tu nombre =)\n");
scanf("%d", &nombre);
printf( "A que onda ");// , nombre);// nombre);
sprintf(nombre, ":D");
getchar();
return 0;
}
|
I know I suk but whats wrong xD _________________
Pin Skipper
Banned by x0r on Tue May 69, 3662 24:09 am. Expires: ForeVa
Reason: Copying gamesguru sig |
|
Back to top |
|
|
appalsap Moderator Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sun Apr 29, 2007 3:07 pm Post subject: |
|
|
sprintf is wrong, you cannot put a formatted string inside a number
Code: |
#include <stdio.h>
void main()
{
int nombre;
printf("Enter nombre.");
scanf("%d", &nombre);
printf("nombre is %d :D", nombre);
}
|
|
|
Back to top |
|
|
FullyAwesome I post too much Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Mon Apr 30, 2007 3:16 am Post subject: |
|
|
lmfao dude use a string or char? _________________
|
|
Back to top |
|
|
Krloz Grandmaster Cheater Reputation: 0
Joined: 25 May 2006 Posts: 525 Location: Mexic00l
|
Posted: Mon Apr 30, 2007 1:19 pm Post subject: |
|
|
Oh I didnt mean to it I changed it to see if it worked but I originally used printf, its because the tutos I use are so crappy x.X _________________
Pin Skipper
Banned by x0r on Tue May 69, 3662 24:09 am. Expires: ForeVa
Reason: Copying gamesguru sig |
|
Back to top |
|
|
|