#include <stdio.h>
main()
{
char name1[15],name2[15],name3[15];
int no;
printf("Enter the serial number and name one\n");
scanf("%d %15c',&no, name1");
printf("%d %15s\n\n",no,name1);
printf("Enter serial number and name two\n");
scanf("%d %s",&no,name2);
printf("%d %15s\n\n",no, name2);
printf("Enter serial number and name three");
scanf("%d %15s",&no,name3);
printf("%d %15s\n\n",no,name3);
}
Hi, I'm new to programming, I've started with C for some reasons. The code I've typed above is my program that I want to execute. When I execute it with Code::Blocks it runs till Enter the serial number and name one and then if I enter a number it become not responding. Then I tried compiling using Visual Studio 2013 it again stops responding.
After that I tried debugging using Visual Studio 2013 debugger it said this First-chance exception at 0x7575B790 (msvcrt.dll) in temp.exe: 0xC0000005: Access violation writing location 0x00000000. after pressing continue it said this Unhandled exception at 0x7575B790 (msvcrt.dll) in temp.exe: 0xC0000005: Access violation writing location 0x00000000. I have programmed before this one in Code::Blocks they all worked well. Please tell me where I've gone wrong. Also please explain the use of %s.
Thanks
Aucun commentaire:
Enregistrer un commentaire