Problem using string pointer
From: kailasam (kailasam.pk_at_in.bosch.com)
Date: 03/10/04
- Next message: David Webber: "Re: Problem using string pointer"
- Previous message: Peter Lin: "NODEFAULTLIB"
- Next in thread: David Webber: "Re: Problem using string pointer"
- Reply: David Webber: "Re: Problem using string pointer"
- Reply: lallous: "Re: Problem using string pointer"
- Reply: Barry Schwarz: "Re: Problem using string pointer"
- Reply: Hendrik Schober: "Re: Problem using string pointer"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Mar 2004 13:23:14 +0530
Hello All,
I was writing a simple code in VC++. It looks like below
METHOD 1 :
char *str = " ADGFR";
*str = 'c';
The above simple code gives runtime error. (the memory could not be written)
But the same if we put as an array say
METHOD2:
char str[] = " " ADGFR";
*str = 'c';
we are able to modify it.
The METHOD1 works well in turbo C but not in VC++
Could you pls explain me the reason for the above
Thanks & Regards
Kailasam
- Next message: David Webber: "Re: Problem using string pointer"
- Previous message: Peter Lin: "NODEFAULTLIB"
- Next in thread: David Webber: "Re: Problem using string pointer"
- Reply: David Webber: "Re: Problem using string pointer"
- Reply: lallous: "Re: Problem using string pointer"
- Reply: Barry Schwarz: "Re: Problem using string pointer"
- Reply: Hendrik Schober: "Re: Problem using string pointer"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|