| |
| |
| |
|
Page: 1 2 3 4 5 6
Comments:
<0> maybe for the compilers you use <1> actually memset sets char values, does it not? <2> In the general case, memset doesn't cut it - it happens to work for the char array, yes, because char is an integer type <0> char is integer type? <1> yeah, it is <3> yes <2> hammr: I really think it would be a good idea for you to learn C before you try to teach it. <4> is work with "" but i can't printf("%s", letter[15]); because the array is not all initialize <1> [ArKaNgE], that would be out of range anyway <4> ok <4> what is the solution? <0> I got out of college in 90 and have been writing C since then <2> If you have a 15-element array, there is no letter[15] <1> what C_Dreamer said <2> Just letter[0] through letter[14] <4> yes
<1> hammr, that's a shame -- I knew that and I"m still in college :) <4> but is not the problem <2> hammr: I refer you to section 3.5.7 of C89. <4> letter[14] or letter[15].. <0> thanks <0> I deal with military specs, not programming specs <0> my code is not portable <2> If you've been writing C for as long as you have, it's about time you learned it. <0> no need <4> wait <2> If you write military code, you really really ought to know the language. <0> I do <0> and #1 rules is dont trust the compiler <2> That is not evident from what you have said here. <4> http://rafb.net/paste/results/HxPloT53.html <2> If you don't trust the compiler, you have to inspect every line of machine code output. <2> So you might as well write the program in machine code. <0> nah, ***embler <0> been there done that <2> You would trust the ***embler, then? <2> There is no logical distinction between trusting the ***embler and trusting the compiler. <1> can you trust your disk to give you back the same machine code you put on it? you might have to check it in RAM every time it is loaded :) <0> yes, in ***embler it is clear that during initiazation variables are initialized as you stated, this is not clear in C <2> hammr - it is extremely clear from 3.5.7 of the ANSI Standard. <0> and yes, in military operations, what is in ram is continuously checked agains the prom <0> again, the militarty has its own standards <2> Fine, but if its language standard differs from ANSI's standard, then it cannot reasonably be claiming to use C. <4> for put all 0 on my char array... <2> It might well be using a very similar language, maybe even a superior language and maybe in a more robust way, but if it ain't ANSI C, it ain't C. <4> how? <2> "If an object that has static storage duration is not initialized explicitly, it is initialized implicitly as if every member that has arithmetic type were ***igned 0 and every member that has pointer type were ***igned a null pointer constant." - ANSI C, 3.5.7 <1> [ArKaNgE], <2> char letter[15] = ""; <0> so your answer should have been ' char letter[15];' <2> "If there are fewer initializers in a list than there are members of an aggregate, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration." <0> wow <1> hammr, that's not static storage duration if it's a local variable. <4> ok is work but i can't printf(%s, letter[15]); because i have letter in letter[2] or letter[8] <2> No, static char letter[15]; would have done, but he doesn't want static, so a partial initialisation is required. <1> hammr, at least not unless you explicitly ask it to be. <0> zzzzzzzzzzzzzz <2> hammr - if the facts bore you, I suggest finding a lamerz channel. <0> haha <0> silly kids <2> <grin> <2> I've been using C longer than you, pal <2> (just) <0> whatever you say kid <1> haha <1> clueless, isn't he? <4> :# <2> Don't bother, cn28h - he wouldn't believe you anyway <1> ;) <5> C_Dreamer since when? <0> see www.drs.com <0> this is where I produce C code <0> bye bye now <1> haha, had to get in a spam before he left <2> jock - C since 1989 - programming in general since 1982 <4> lol <3> I thought the military and its contractors used Ada.
<2> <meta NAME="ColdFusionMXEdition" CONTENT="ColdFusion DevNet Edition - Not for Production Use."></head> <2> (From the DRS Web site's HTML) <1> haha <2> Nice graphic though <4> can I write a string which content only 1 letter in letter[3] <4> **** my english :( <4> and declaration char letter[15] = "";` <4> before <1> [ArKaNgE], it wouldn't make a lot of sense to start your string at &letter[3] <1> but you *could* <4> cn28h <2> Look, it's really easy. If N is a constant, then char letter[N]; gives you an array of N chars. char letter[N] = ""; gives you an array of N chars all set to the null character '\0'. Once you have your array defined, letter[n] = x; /* sets the nth character in the array to the value x; n must be in the range 0 to N-1 */ <4> i have a word...in mot[15] and i compare the word whit letter in char letter;...whit the letter match, i put the letter in match_letter[i]...but if the word is LiGHT, and the letter match is G...the letter go on martch_ltter[2]... <2> What are you trying to do, compare two strings? <4> no compare char whit char array <2> Didn't we cover that before? <2> I suggested you use strchr <4> if(m6400_lettre == m6400_mot[b]) <4> { <4> m6400_mot_joueur[b] = m6400_lettre; <4> } <4> ok <2> that's fine - it's comparing two characters directly <4> if two letter is same in the word, strchr continu or stop? <1> you will likely end up with gaps in m6400_mot_joueur <2> strchr returns a pointer to the /first/ match it finds, or NULL if there is no match <4> ok <4> is not good for me... <4> if the word is letter, have ton T in the word <1> but you can strchr() from the next location after where the previous letter was found <4> two... <1> so you can find the next occurence that way <4> ok <4> is to advance for me i think... <1> are you familiar with "array slicing"? <2> I give up. I'm sorry, [ArKaNgE] - you know my language much better than I know yours, but the communication barrier is still too high for me to climb. <4> no <4> yes i speak bad english hehe <4> im pratice c and english <1> it's actually not too bad, considering :) <1> as C_D said, it's much better than my French as well <4> hehe <4> what is array slicing <1> but are you familiar with pointers? If so, array slicing is easy <4> yes i understand pointer... <1> ok, well take this example: <1> char foo[] = "Hello World!\n"; printf("%s", &foo[6]); <1> what is printed? <5> is there a datastructure that has more efficient random access than linked list and doesn't make pointers to other element invalid when you add a new element? <4> print the adress of foo[6] <1> [ArKaNgE], no, it's using %s <4> i dont now <1> [ArKaNgE], &foo[6] is the address of the 6th element, right? <4> yes <1> so it starts reading the string at index 6, and prints "World\n" <1> try ikt <4> ok <1> jock, what od you mean by makes pointers to other elements invalid? <1> oh <4> the printf stp at adress ?foo[6] <1> right, it reads from that address and gets therest of the string <1> jock, trees <4> i read from the adress or stop to this adress... <6> printf %s stops when it finds a \0 <4> i = he... <1> jock, in a balanced tree, looking up an element is O(lg n) where as in a linked list it's O(n) <6> you only give it the start address <4> ok <1> jock, or you might look at a hash table <4> what is hash <5> how does hash table have more efficient random access <1> jock, because the hash tells you where to look <5> actually it does <1> [ArKaNgE], doin't worry about that for now :)
Return to
#c or Go to some related
logs:
users.undernet.org
#linux zenity cron chatzone for kids
how gtalk use comet
#london #java blooditza #london #MissKitten
|
|