Click here to Skip to main content
15,906,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accessing private Member Pin
David Crow13-Nov-06 3:56
David Crow13-Nov-06 3:56 
AnswerRe: Accessing private Member Pin
Christian Graus12-Nov-06 21:48
protectorChristian Graus12-Nov-06 21:48 
GeneralRe: Accessing private Member Pin
Aqueel12-Nov-06 22:04
Aqueel12-Nov-06 22:04 
GeneralRe: Accessing private Member Pin
baerten12-Nov-06 22:22
baerten12-Nov-06 22:22 
GeneralRe: Accessing private Member Pin
Aqueel13-Nov-06 2:26
Aqueel13-Nov-06 2:26 
QuestionReduce colors of bitmap files Pin
includeh1012-Nov-06 20:51
includeh1012-Nov-06 20:51 
AnswerRe: Reduce colors of bitmap files Pin
Christian Graus12-Nov-06 21:47
protectorChristian Graus12-Nov-06 21:47 
Questionpassing structs Pin
thathvamsi12-Nov-06 20:49
thathvamsi12-Nov-06 20:49 
Hey all, Iam currently trying this small example to understand the pointers, arrays,etc. in C.
When I try executing the following , the program breaks inside fruitexec() as it would pass the list FrList sometime and not other time.
Why? Isnt the list passed the right way?
Am I pointing at differnt location?
Any help appreciated.

struct Fr_t<br />
{<br />
	/*! \brief The name of this fruit. */<br />
	char *	name;<br />
	/*! \brief The colour. */<br />
	char * colour;<br />
	<br />
};<br />
static struct Fr_t g_fr[] =<br />
{<br />
<br />
	{<br />
		"Apple",<br />
		"pink",<br />
		<br />
	},<br />
	{<br />
		"Mango",<br />
		---<br />
		<br />
	},<br />
<br />
	{<br />
		<br />
	},<br />
<br />
	{<br />
		<br />
	},<br />
	{<br />
		0,<br />
		0,<br />
		0<br />
	}<br />
};<br />
<br />
struct FrList_t<br />
{<br />
char * name;<br />
} FrList_s[4];<br />
<br />
all the above structs are declared globally.<br />
<br />
<br />
<br />
static struct Fr_t* pickFr( struct Fr_t *Frtcollection, const char * name ) <br />
{<br />
	struct Fr_t * what = 0;<br />
	if ( Frtcollection )<br />
	{<br />
		<br />
		for ( what = Frtcollection; what->name; ++what )<br />
		{<br />
			if ( strcmp( what->name, name ) == 0 )<br />
			{<br />
				break;<br />
			}<br />
		}<br />
		<br />
	}<br />
	<br />
	return ( what );<br />
}<br />
<br />
<br />
<br />
<br />
int fruitexec(int farm, struct FrList_t * Fr_List)<br />
{<br />
int next_fr = 0;<br />
struct Fr_t* fruit = 0;<br />
--------<br />
------<br />
Fr_List = & (FrList_s[next_fr])<br />
if( FrList_s[next_fr].name )<br />
	{<br />
	 fruit = pickFr( g_fr, Fr_List->name );<br />
	}<br />
	<br />
	printf( "The name is %s.\n", FrList_s[next_fr].name );<br />
<br />
<br />
-------<br />
---------<br />
}<br />
in main, we assign <br />
{<br />
FrList_s[0] = "Mango";<br />
FrList_s[1] = "Apple";<br />
...<br />
....fruitexec(..., Fr_List_s);<br />
}

AnswerRe: passing structs Pin
Rage12-Nov-06 21:44
professionalRage12-Nov-06 21:44 
AnswerOT Pin
Rage12-Nov-06 21:46
professionalRage12-Nov-06 21:46 
GeneralRe: OT Pin
thathvamsi12-Nov-06 21:51
thathvamsi12-Nov-06 21:51 
GeneralRe: OT Pin
Rage12-Nov-06 22:07
professionalRage12-Nov-06 22:07 
GeneralRe: OT Pin
thathvamsi12-Nov-06 22:11
thathvamsi12-Nov-06 22:11 
GeneralRe: OT Pin
Rage12-Nov-06 23:34
professionalRage12-Nov-06 23:34 
QuestionRe: OT Pin
David Crow13-Nov-06 3:49
David Crow13-Nov-06 3:49 
AnswerRe: OT Pin
Rage13-Nov-06 4:03
professionalRage13-Nov-06 4:03 
AnswerRe: passing structs Pin
Michael Dunn12-Nov-06 22:15
sitebuilderMichael Dunn12-Nov-06 22:15 
QuestionMDI Pin
GANsJob12-Nov-06 20:24
GANsJob12-Nov-06 20:24 
AnswerRe: MDI Pin
includeh1012-Nov-06 20:57
includeh1012-Nov-06 20:57 
GeneralRe: MDI Pin
Rage12-Nov-06 21:47
professionalRage12-Nov-06 21:47 
AnswerRe: MDI Pin
Rage12-Nov-06 21:48
professionalRage12-Nov-06 21:48 
Questioncannot process WM_KEYUP for property window Pin
vikas amin12-Nov-06 20:23
vikas amin12-Nov-06 20:23 
AnswerRe: cannot process WM_KEYUP for property window Pin
includeh1012-Nov-06 21:12
includeh1012-Nov-06 21:12 
QuestionHow to capture keyboard events ? Pin
Kvaibhav12-Nov-06 20:13
Kvaibhav12-Nov-06 20:13 
AnswerRe: How to capture keyboard events ? Pin
Rajesh R Subramanian12-Nov-06 20:47
professionalRajesh R Subramanian12-Nov-06 20:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.