1,088 Posted Topics

Member Avatar for mattyd

Ultimally, is all a moral decision. You choose to believe in God or not. The "proofs" will not help you to make that decision in one way or another. Moreover, God exist independenly of what we believe or not.

Member Avatar for ~s.o.s~
3
10K
Member Avatar for Maabou

[QUOTE=Salem;596560]That's because what I posted were NOT CHANGES, they were hints. As in, you read them and then think about what they're saying, then apply that fresh insight to your specific problem.[/QUOTE] An implementation of: [I]Give a man a fish and he will eat for a day. Teach a man …

Member Avatar for midimatt
0
166
Member Avatar for Firestone

[code=C]/* * p_operators.c * it demostrates some of the converter operators in printf() * */ #include <stdio.h> int main( void ) { int x = 123; double y = 4.5678; int len = 9; char text[10] = "Hello"; /* * string formatting options */ printf( "\nString formatting options\n" ); printf( …

Member Avatar for JLChafardet
0
289
Member Avatar for Sh13

Make the prototype: [iCODE]void PrintString(char [COLOR="Red"]*[/COLOR]*pArray)[/iCODE] add an extra [B]*[/B] Call the function as: [iCODE]PrintString([COLOR="Red"]*[/COLOR]array);[/iCODE] remove the [B]*[/B] Display each subscript of the pointer: [iCODE]printf("%d - %5s", i, pArray[COLOR="Red"][i][/COLOR] );[/iCODE] add the individual pointer subscript [B][i][/B]

Member Avatar for Sh13
0
101
Member Avatar for kittykat1982

>I have set the BIOS to check the CD Drive first Assuming that it means you have set the BIOS to boot from CD correctly. Either the CD drive is not working correctly or the disc doesn't have/can't read from a booting process. Have you tried to download another distro …

Member Avatar for kittykat1982
0
100
Member Avatar for pete212

In order to access a file a few key components need to play together. A string with the name/location of the file. A FILE pointer that will become the handle for that file. A function named fopen() to try to open that file for reading, writing, appending, etc... A function …

Member Avatar for pete212
0
84
Member Avatar for Afi83

[QUOTE=tah;584781]HI Sir I wish to write a program that can do the following [/QUOTE] I can assure you that no one over here will prevent you from doing so. It is customary to read the rules of the forum if you are posting for the first time. Allow me to …

Member Avatar for Afi83
0
437
Member Avatar for dgg32

[QUOTE=dgg32;590646]don't quite get it. I have defined it as a char * word. what should I do? thanks[/QUOTE] Here's a [URL="http://www.augustcouncil.com/~tgibson/tutorial/ptr.html"]visual help[/URL] to understanding pointers

Member Avatar for Aia
0
373
Member Avatar for w0090463

[iCODE]*ptr; [/iCODE] decoration pointer. Not used at all. [iCODE]if (fgets(filename,MAX_FILENAME_LEN,stdin) == [COLOR="Red"]0[/COLOR])[/iCODE] fgets() returns a pointer. [iCODE]if( fgets( filename, MAX_FILENAME_LEN, stdin ) == [COLOR="Green"]NULL [/COLOR])[/iCODE] [iCODE]filename[--length] = [COLOR="Red"]0[/COLOR]; // chomp newline[/iCODE] 0 is not the same than '\0'. The '\n' is not guarantee to be there. [iCODE]quitstring[i] = [COLOR="Red"]tolower[/COLOR](filename[i]);[/iCODE] tolower …

Member Avatar for ajay_kumar47
0
174
Member Avatar for squint

>When I enter 26.2, it gives me 26.20001. I do not understand where that 1 is coming from. A float only has 6-digits of precision, anything else is garbage. >i ran the code and changed the num variable to type double and changed the scanf function to %lf >and it …

Member Avatar for jephthah
0
116
Member Avatar for wsn

[iCODE]while (strcmp(Command,[COLOR="Red"]"\0"[/COLOR] ))[/iCODE] When would ever occur that a string is made of string[0] = '\0'; and string[1] = '\0';? That's what "\0" is; a string of 2 bytes. [CODE]Strcmp: if: Returns value Explanation ------------- ----------- less than 0 str1 is less than str2 equal to 0 str1 is equal …

Member Avatar for wsn
0
101
Member Avatar for wollacott

>any pointers on how to do this Yes, start working on the section that will turn a given string into what you want. Once you grasp the concept of reversing the string, you can start with the whole reading/writing to file busyness.

Member Avatar for Aia
0
132
Member Avatar for sahil_itprof

>Can any onbe say me the exact difference between a pointer (*p) and the array p[]???? Further study. [url]http://c-faq.com/aryptr/aryptr2.html[/url] [url]http://c-faq.com/aryptr/practdiff.html[/url] [url]http://c-faq.com/aryptr/ptrkindofary.html[/url]

Member Avatar for Aia
0
182
Member Avatar for Aia

Frustrating doesn't even start to describe the experience that wanting to post a well formated snip of code is at times. [B]e.g[/B] [URL="http://www.daniweb.com/forums/post583165-6.html"]Example[/URL] Spent quite sometime aligning expressions and clicking the darn "preview bottom". When everything seems to look more or less what I wanted, I pressed "Submit" and what …

Member Avatar for Aia
0
169
Member Avatar for cbrown153

[CODE]while(strcmp(text[[COLOR="Red"]k[/COLOR]]," ")!=0){ if(strcmp(text[[COLOR="Red"]k[/COLOR]],"/0")==0){[/CODE] strcmp() is prototyped as: [iCODE]int strcmp ( const char * str1, const char * str2 ); [/iCODE] The first argument passed to it must be a string. [COLOR="Red"]text[k][/COLOR] is a character and not a string. Haven't look at your program logic. [edit:] [iCODE]currWord[i]=text[k];[/iCODE] That will not work …

Member Avatar for Aia
0
69
Member Avatar for Sh13

Did you initialized miles before starting to add to it? [B]Funny part:[/B] [iCODE]fscanf(ifp, "%f", [COLOR="Red"]array[i].miles[/COLOR]);[/iCODE] array[i].miles is the field of a structure array element. [iCODE]miles += [COLOR="Red"]array[i][/COLOR];[/iCODE] array[i] is an element of an array, hopefully float or double.

Member Avatar for Sh13
0
119
Member Avatar for shadow_shooter

[QUOTE=shadow_shooter;583183]Salem, could you please explain why we use * in function parameters for the following program. Isn't it the same situation? [/QUOTE] I am not Salem, and I am sure he can explain it better than me, but meanwhile... [iCODE]createList(&myList);[/iCODE] If not & you'll be passing the value of myList …

Member Avatar for Aia
0
279
Member Avatar for nelledawg

>I cannot for the life of me get the pointers concept down Forgive me, but you don't seem to get the concept of loops, nor the concept of proper format operant for printf() or scanf() neither. Just an example of your code: [CODE=c]double getgrades(double *s) /* s is never used …

Member Avatar for Aia
0
234
Member Avatar for shadow_shooter

[iCODE]while(!feof(polyFile))[/iCODE] >I've solved the problem feof() is never a solution to control a loop. Read [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046476070&id=1043284351"]here[/URL] why.

Member Avatar for shadow_shooter
0
304
Member Avatar for MaestroRage

[iCODE]while ((c=getchar())!='e' && (c=getchar())!='E')[/iCODE] Think about this a little bit more. You are reading from stdin twice: [iCODE](c=getchar())!='e'[/iCODE] and then you read again another character [iCODE] (c=getchar())!='E'[/iCODE]. Most like it an entered letter and the "ENTER" key. If that evaluates to TRUE in the loop you read one more time …

Member Avatar for Aia
0
146
Member Avatar for TheSmokey777

This is not C but C++; and if you don't know that, I am afraid you'll have a hard time convincing me that this is your code.

Member Avatar for jephthah
0
105
Member Avatar for Gerritt

[COLOR="Red"]double[/COLOR] show_costs(double *poi, double molah, int count) Shouldn't that be void since you are returning 0? [COLOR="Red"]int *mn;[/COLOR], [COLOR="Red"]double *molahpnt;[/COLOR] I understand you want to play with pointers, however those are not necessary. double molah and int count could have been passed as pointers as well instead as a copy …

Member Avatar for jephthah
0
113
Member Avatar for nelledawg

I don't see any function definition for toUpper(). But I see a function named firstUpper(). Is that the one? [CODE=c]void firstUpper(char *buf) { *buf=toupper(*buf); // first char CAP while (*buf++ != '\0') if (*buf == ' ') // look for space *buf=toupper(*++buf); // CAP next char }[/CODE] I hope you …

Member Avatar for jephthah
0
115
Member Avatar for wollacott

[iCODE]char * fgets ( char * sc, int num, FILE * words );[/iCODE] fgets is a standard function you don't need to prototype it. It is defined in stdio.h. [iCODE]while((myfileptr=fgets(myfileptr))!=EOF)[/iCODE] fgets doesn't work like that. A variable to hold the string needs to be declared first [iCODE]char buffer[ANYSIZE];[/iCODE] Then you …

Member Avatar for jephthah
0
288
Member Avatar for wollacott

>g.c:26: error: parse error before string constant By not using proper indentation is hard for you to see that you have mismatched brackets.

Member Avatar for Aia
0
313
Member Avatar for wollacott

[URL="http://www.c.happycodings.com/code_snippets/code30.html"]enum[/URL] will allow you to do that.

Member Avatar for Aia
0
121
Member Avatar for lemichelle

>It is like nothing is going into the second string! The first scanf is reading until it encounters the space. The second scanf is reading the remainder, until it encounters a space again or a newline, whichever is first. scanf is not a good player for reading strings. Use fgets()

Member Avatar for Aia
0
79
Member Avatar for wsn

>I understand that it didn't 1234 because it was optional and no varaible is declared for it, You understand incorrectly, 1234 was skipped because that's what the * is saying when you inserted it in [iCODE]%*d[/iCODE] with the function scanf. > but for scanning %2s isn't suppose to return the …

Member Avatar for wsn
0
99
Member Avatar for lemichelle

>5. Where do all the function libraries come from? From the supermarket like potatoes and hamburger meat. Everyone does know that, doesn't it? >Did someone just create them and give them away? Nope, "The Library of Congress" issues license every year for the public to use those libraries, that's why …

Member Avatar for Aia
0
77
Member Avatar for Metahuman

[QUOTE=Metahuman;573591]Thanks ... that worked ... though am not very sure how ?? ..... google didn't help me much from the lead you had given how wexactly the offsets besides the % signs work ??[/QUOTE] [iCODE]print "[COLOR="Red"]%[/COLOR][COLOR="Green"]-[/COLOR][B]20[/B]s %4d" % ("John Smith",107)[/iCODE] [COLOR="Red"]%[/COLOR] Is the conversion specifier. It tells print that what …

Member Avatar for BearofNH
1
195
Member Avatar for fruitkiwi

[QUOTE=fruitkiwi;572863]thanks jephtlah.i try to run ur code but it seems like got some problem.kindly help me again. [CODE]#include <stdio.h> #include <string.h> #include<ctype.h> int letterValue(char letter); int main(char *roman) { int arabic = 0, tmp; char *str_p = roman; while(*str_p) { tmp = letterValue(*str_p); if (letterValue(*++str_p) > tmp) arabic -= tmp; …

Member Avatar for jephthah
0
191
Member Avatar for fruitkiwi

Perhaps is best if you work in small portions of what you intend to do; testing that you understand the principle first in an isolated state. [B]e.g.[/B] [CODE=C]void readinput(char english[]) { int count=0; char c; while((c=getchar())!='\n') { english[count]=c; ++count; } return; }[/CODE] [B]Consider:[/B] The while loop will keep copying characters …

Member Avatar for jephthah
0
159
Member Avatar for wsn

[URL="http://www.cppreference.com/stdstring/strstr.html"]strstr()[/URL] will help you to achieve that.

Member Avatar for Aia
0
110
Member Avatar for pete212

>If you enter 16 for example, it displays G (as i expected) 16 is not G in hexadecimal notation. It's 10. All that you need to display hexadecimal numbers is to use the %x format in printf().

Member Avatar for WaltP
0
150
Member Avatar for knight fyre

[B]bool[/B] is an afterthought of a boolean type for c added in C99 but it doesn't exit in C89. A macro BOOL exist for C89 but... no need. [CODE]#define FALSE 0 #define TRUE (!FALSE) int found = FALSE; and inside the loop found = TRUE;[/CODE]

Member Avatar for Aia
0
312
Member Avatar for Nessie

[QUOTE=Narue;570301] >*(array + count) = ch ; Just out of curiosity, why add the unnecessary complexity of pointer notation here?[/QUOTE] Is it really that much complex from [icode]array[count][/icode] that it would warrant wondering? [B]Separate question:[/B] Doesn't the compiler default to substitute array notation for pointer notation?

Member Avatar for Nessie
0
112
Member Avatar for Crushyerbones

> Does anyone know the right method to terminate a string by the way? Right method depends of what you are doing. [CODE]current[strlen( a ) + 1] = '\0';[/CODE] [CODE]current[ x+1 ] = '\0';[/CODE]

Member Avatar for Crushyerbones
0
122
Member Avatar for jitendersharma
Member Avatar for Aia
0
74
Member Avatar for modaslam

>but how do i convert this code in to C code?? [B]print ' ' [/B] ---> How would you display a space in C? [B]print n '*'[/B] ---> How would you display a * as many times as n is equals to? [B]for i = 0 to n do[/B] [B]print …

Member Avatar for Narue
0
116
Member Avatar for severman

[CODE=c]typedef struct { int id; //מספר הזהות של הסטודנט char full_name[LEN]; //שם ושם משפחה struct { unsigned sem_a; //ממוצע הציונים בסמסטר ראשון unsigned sem_b; //ממוצע הציונים בסמסטר שני }grades; //משתנה של ציונים מטיפוס של מבנה }Student;[/CODE] I believe you can benefit of reading this conversation. Click [URL="http://groups.google.com/group/comp.lang.c/browse_thread/thread/9d0f385376099f83/68aa047e41b7df51?lnk=st&q=typedef+author%3Atorek+group%3Acomp.lang.c#68aa047e41b7df51"]here[/URL] Nevertheless: [CODE]Student A[]={ …

Member Avatar for Aia
0
109
Member Avatar for barbiegirl

[QUOTE=bwjones;557368]Maybe english isn't her primary language?[/QUOTE] Regardless, it is still a good suggestion.

Member Avatar for barbiegirl
0
195
Member Avatar for bwjones

[QUOTE=bwjones;557369]Can someone inform me on what the "-=" function does? thanks.[/QUOTE] It is not a function is an arithmetic operator and assignment operator short cut. [B]number -= x;[/B] same as [B]number = number - x;[/B]

Member Avatar for WaltP
0
101
Member Avatar for bwjones

[COLOR="Red"]cnt = cnt++;[/COLOR] [COLOR="Green"]/* undefined behavior */[/COLOR] [B]Nope.[/B] [COLOR="Green"]cnt = cnt + 1;[/COLOR] or [COLOR="Green"]++cnt;[/COLOR]

Member Avatar for bwjones
0
109
Member Avatar for Gerritt

double show_costs([COLOR="Red"]int n[],[/COLOR] double c); first parameter is an array of integers show_costs([COLOR="Red"]log[/COLOR], vald); log is not an array of integers. if([COLOR="Red"]n[] [/COLOR]< 5) incorrect syntax, there must be a subscript inside the []

Member Avatar for mitrmkar
0
200
Member Avatar for Crushyerbones

As soon as the block ( between the {} or single statement in the if/else control flow ) is executed the string disappears. I suppose you want something like: [CODE=c]#include <string.h> /* for strcpy function */ char real_out[20] = { '\0' }; /* array declared outside the if/elses */ int …

Member Avatar for Crushyerbones
0
113
Member Avatar for os.hacker64

[QUOTE=os.hacker64;555220]I doubt you since you are a n00b. ^ |:)[/QUOTE] A simple "Thank you!" would have suffice.

Member Avatar for Ancient Dragon
0
95
Member Avatar for midimatt

Maybe[URL="http://www.network-theory.co.uk/docs/gccintro/gccintro_18.html"] this[/URL] will help

Member Avatar for midimatt
1
356
Member Avatar for mmc18

Now, what's your question? Stop over [URL="http://www.daniweb.com/forums/post452439-1.html"]here[/URL] and read how to properly post your code

Member Avatar for mmc18
0
116
Member Avatar for Metahuman

>This is obviously due to the order of execution of the assignment operator. That's [B][I][URL="https://www.securecoding.cert.org/confluence/display/cplusplus/EXP34-C.+Do+not+depend+on+order+of+evaluation+between+sequence+points"]Undefined Behavior[/URL] [/I][/B].

Member Avatar for Aia
0
107
Member Avatar for bwjones

void calculate_and_print(int n); [B]is not the same than[/B] void calculate(int n) double get_value(void); [B]is not found[/B] printf("The average temperature is %[COLOR="Red"]l[/COLOR]f\n\n",[COLOR="Red"]n, [/COLOR]average); [COLOR="Green"]/* remove the n and the l */[/COLOR]

Member Avatar for bwjones
0
187

The End.