| | |
what is strcmp do? strcmp work?
Thread Solved |
•
•
Join Date: Aug 2009
Posts: 25
Reputation:
Solved Threads: 1
i have loaded the string data from file to double array.this is example:
const_array[1][]=a1,b1,c3,
const_array[2][]=a2,b1,c3,
const_array[3][]=a3,b2,c2,
const_array[4][]=a2,b3,c1,
const_array[5][]=a3,b2,c1,
those data need to be compared to this string:
append_test_data.this is also an array and it will be changed randomly by d program.the prob is,my prog just compare to the last data in array,const_array[5][]=a3,b2,c1,
i use this code to compare.
my question is,how is strcmp works?is it compare to the lenght of the string or the string itself?why dose it compare to the last data in array?
const_array[1][]=a1,b1,c3,
const_array[2][]=a2,b1,c3,
const_array[3][]=a3,b2,c2,
const_array[4][]=a2,b3,c1,
const_array[5][]=a3,b2,c1,
those data need to be compared to this string:
append_test_data.this is also an array and it will be changed randomly by d program.the prob is,my prog just compare to the last data in array,const_array[5][]=a3,b2,c1,
i use this code to compare.
c Syntax (Toggle Plain Text)
for(int n=1;n<=m;n++) { if(strcmp(append_test_data,const_array[n]) == 0) { printf("Append data is =%s\n",append_test_data); printf("constraint is found=%s\n",const_array[n]); getch(); exit(0); } }
my question is,how is strcmp works?is it compare to the lenght of the string or the string itself?why dose it compare to the last data in array?
•
•
Join Date: Aug 2009
Posts: 25
Reputation:
Solved Threads: 1
is it include this kind of string?
a1,b1,c3 compare to a2,b1,c1
if dat so, why is my code just compare the last last in array?
do u have any comment about my code?
im really stuck wif this thing.....
a1,b1,c3 compare to a2,b1,c1
if dat so, why is my code just compare the last last in array?
do u have any comment about my code?
im really stuck wif this thing.....
•
•
Join Date: Jun 2009
Posts: 99
Reputation:
Solved Threads: 4
is it "a1","b1" ,"c1" or "a1,b1,c1"?
It is a simple concept of array if u have to compare every value u have to give both the entities an index ..[max_length].U have to modify accordingly if the two arrays are not of the same length.It is probably finding only the last value because append_test_data without an index is just one value.
It is a simple concept of array if u have to compare every value u have to give both the entities an index ..[max_length].U have to modify accordingly if the two arrays are not of the same length.It is probably finding only the last value because append_test_data without an index is just one value.
•
•
Join Date: Aug 2009
Posts: 25
Reputation:
Solved Threads: 1
•
•
•
•
is it "a1","b1" ,"c1" or "a1,b1,c1"?
It is a simple concept of array if u have to compare every value u have to give both the entities an index ..[max_length].U have to modify accordingly if the two arrays are not of the same length.It is probably finding only the last value because append_test_data without an index is just one value.
i use const_array as double array so that everytime i just query the row,not the column.
and append_test _data is just a string array.
do u meant with this declaration :
char append_test_data [MAX_LENGTH]="";
i use "" in this array.does it effect?
![]() |
Similar Threads
- Main prog..help!! (C)
- Question about strcmp (C)
- reading a text file and searching for a sentence (C++)
- How to represent a space and a tab? (C++)
- How How How???!!!! (C++)
- get the coordenates of a word in a puzzle (C)
- removing the null terminator at the end of string (C)
- how to place a specific info from input file (C)
Other Threads in the C Forum
- Previous Thread: no one has yet to answer this question
- Next Thread: C basics - incompatible error
| Thread Tools | Search this Thread |
* adobe api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking hardware highest homework i/o ide inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h






