Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Find Error in the code

View previous topic View next topic Go down

Find Error in the code

Post  Nishchal on Sun Jun 06, 2010 12:10 am

What the errors in following code:-
Language=C;
Type:Error Detection & removal.


Code:
void main()
{
      const int x;
      printf("\n Enter a num=");
      scanf("%d",x);
      x=20;
      printf("%d",x);
     
}
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

Re: Find Error in the code

Post  vijay thakur on Sun Jun 06, 2010 12:43 am

void main()
{
const int x;
printf("\n Enter a num=");
scanf("%d",x);
x=20;
printf("%d",x);

}


error to yehi hai ki aapne scanf function me address operator nai lagya hai..so compiler phele x ki garbage value hi pick karega..then uske baad x=20 define kiya gya hai..atlast 20 print hoga.....
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Nishchal on Mon Jun 07, 2010 10:16 am

vijay thakur wrote:void main()
{
const int x;
printf("\n Enter a num=");
scanf("%d",x);
x=20;
printf("%d",x);

}


error to yehi hai ki aapne scanf function me address operator nai lagya hai..so compiler phele x ki garbage value hi pick karega..then uske baad x=20 define kiya gya hai..atlast 20 print hoga.....
this problem may not be that easy as it looks
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

Re: Find Error in the code

Post  vijay thakur on Mon Jun 07, 2010 1:58 pm

so wt type of error shall we find in this problem...?????
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Nishchal on Mon Jun 07, 2010 2:40 pm

vijay thakur wrote:so wt type of error shall we find in this problem...?????
try to compile it and see what errors popup.....
bounce bounce bounce bounce
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

Re: Find Error in the code

Post  vijay thakur on Mon Jun 07, 2010 3:05 pm

sir i don't have tc in my notebook...so i cannot compile..
Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Very Happy
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Nishchal on Mon Jun 07, 2010 3:48 pm

vijay thakur wrote:sir i don't have tc in my notebook...so i cannot compile..
Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Mad Very Happy
download Dev CPP from net.....
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

errors;;;;

Post  vijay thakur on Sun Jun 13, 2010 12:25 am

uninitialized const `x8
assignment of read-only variable `x'
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Nishchal on Mon Jun 14, 2010 10:13 am

vijay thakur wrote:uninitialized const `x8
assignment of read-only variable `x'
Reason???
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

Re: Find Error in the code

Post  vijay thakur on Mon Jun 14, 2010 1:54 pm

reason........?????wt reson?????
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Nishchal on Tue Jun 15, 2010 9:53 am

vijay thakur wrote:reason........?????wt reson?????
reason for that error...... Suspect Suspect Suspect
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

Re: Find Error in the code

Post  vijay thakur on Tue Jun 15, 2010 11:50 pm

sir i don't knw the proper reason...will u tell?????? Sad
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Nishchal on Sat Jun 19, 2010 11:08 pm

vijay thakur wrote:sir i don't knw the proper reason...will u tell?????? Sad
all const veriable must be intialized at the declaretion. after that u cant modify them (well there is a way to modify them, but thats whole new case ) albino
avatar
Nishchal
The Last Don

Posts : 55
Join date : 2010-05-22
Age : 32

View user profile http://gpdckullubca.forum-motion.com

Back to top Go down

Re: Find Error in the code

Post  vijay thakur on Tue Jun 22, 2010 11:59 pm

hmm.....thanks sir... Very Happy
avatar
vijay thakur
Starters

Posts : 25
Join date : 2010-05-23
Age : 25
Location : kullu

View user profile

Back to top Go down

Re: Find Error in the code

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum