Posts
 
Reputation
Joined
Last Seen
Ranked #928
Strength to Increase Rep
+5
Strength to Decrease Rep
-1
79% Quality Score
Upvotes Received
6
Posts with Upvotes
6
Upvoting Members
5
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
2
4 Commented Posts
0 Endorsements
Ranked #4K
~62.5K People Reached
Favorite Tags
c x 180
java x 40
c++ x 3
perl x 2
Member Avatar for COKEDUDE

I was looking at this struct tutorial. https://www.tutorialspoint.com/cprogramming/c_structures.htm It mentions "The structure tag is optional". How would you refer to your struct if there is no structure tag? struct { char title[50]; char author[50]; char subject[100]; int book_id; }; //something like this? struct random_name;

Member Avatar for Schol-R-LEA
0
67
Member Avatar for COKEDUDE

How would you describe c programming to a person that does not know anything about computers?

Member Avatar for rproffitt
0
193
Member Avatar for COKEDUDE

I sometimes move my code around to various computers so I prefer to keep my header files in my current directory. Unfortunately it does not seem to be working. $ gcc *.c -Wall main.c:1:10: fatal error: mysql.h: No such file or directory 1 | #include <mysql.h> | ^~~~~~~~~ compilation terminated.

Member Avatar for rproffitt
0
37
Member Avatar for COKEDUDE

I am doing a team project with some people that prefer Linux and some people prefer Windows. We are also not allowed to share code for security reasons. One thing the Windows people love to whine about is a way to hold the window open. So the way they usually …

Member Avatar for liammasson33
0
2K
Member Avatar for COKEDUDE

I am trying to replace a string in a function with double pointers. I would like to see this change back in main. What am I doing wrong? These are the warnings my compiler gave me. $ gcc *.c -Wall main.c: In function ‘replacevalue’: main.c:10:12: warning: passing argument 1 of …

Member Avatar for nullptr
0
2K
Member Avatar for COKEDUDE

I have 30 functions like this void func1(int *var1, int *var2) { func2(var1, var2); } void func2(int *var1, int *var2) { func3(var1, var2); } void func3(int *var1, int *var2) { func4(var1, var2); } I do not need var3 until func15. Is there a way to fix this mistake without having …

Member Avatar for bdux
0
674
Member Avatar for COKEDUDE

If you have a counter that gets incremented through multiple functions, is it better to use a global counter or pointer counter? They both work just curious which is better and why.

Member Avatar for Reverend Jim
1
1K
Member Avatar for COKEDUDE

I am trying to a % in a printf statement represent 10%. How do I do that? My compiler warnings are complaining about it. I tried a backslash but that didn't work. printf(" 10\% of people \n");

Member Avatar for nullptr
0
142
Member Avatar for COKEDUDE

Whats the best way to removes values from array of strings? Is it better to create a new array of strings or is there some way to remove them?

Member Avatar for AssertNull
0
403
Member Avatar for COKEDUDE

Why does order matter with this if else if statement? if((row1 = mysql_fetch_row(result1)) && adding_to_member_flag != 1) { printf("Do not update date since it already exists\n"); } else if(!(row1 = mysql_fetch_row(result1)) && adding_to_member_flag != 1) { printf("Update end_date and add new team\n"); } When I had it like this the …

Member Avatar for AssertNull
0
417
Member Avatar for COKEDUDE

My second while condition is being ignored and I don't understand why. I would think I have 1 and 0 = 0 so it would break out. while(fgets(line, sizeof line, stdin) && sscanf_counter != 2) { }

Member Avatar for rubberman
0
263
Member Avatar for COKEDUDE

I am trying to print my data in columns. For some reason every column but the last one lines up. Is there a way to fix this? while ((row = mysql_fetch_row(result))) { //printf("198\n"); for(int i = 0; i < num_fields; i++) { //printf("----------\n"); printf("%25s ",row[i]); if(row[i] == NULL) { printf("No …

Member Avatar for cereal
0
250
Member Avatar for COKEDUDE

I am trying to set a record back to null. I was able to change it from null and now I want to change it back to null. For some reason it is not working. This worked perfectly fine: UPDATE members set end_date = "2017-01-18" where player = 1 and …

Member Avatar for COKEDUDE
0
291
Member Avatar for COKEDUDE

What does this printf do? Not familiar with the question mark, colon, and extra NULL at the end. printf("%s ", row[i] ? row[i] : "NULL");

Member Avatar for hericles
0
174
Member Avatar for COKEDUDE
Member Avatar for rproffitt
0
1K
Member Avatar for COKEDUDE

How would I split this big if statement across multiple lines? It works perfectly on one line. if (mysql_query(con, "CREATE TABLE Matches(match_id INT UNSIGNED PRIMARY KEY, date DATETIME NOT NULL, tournament INT UNSIGNED, playerA INT UNSIGNED, playerB INT UNSIGNED, scoreA INT UNSIGNED, scoreB INT UNSIGNED, offline bool)")) { finish_with_error(con); } …

Member Avatar for AndrisP
0
265
Member Avatar for COKEDUDE

This is what I came up with for reading a csv file with multiple types. It seems to get the job done in all cases but 1,2,,"a". Where there is a blank space. Can I please have some ideas on how to fix this? const char* getfield(char* line, int num) …

Member Avatar for COKEDUDE
0
329
Member Avatar for COKEDUDE

I keep getting this message. undefined reference to `mysql_get_client_info' From what I can figure out when I google it I am not linking correctly. So I tried this. gcc *.c -L"C:\Program Files\MySQL\MySQL Server 5.7\lib" Can I please get some help on what I am doing wrong?

Member Avatar for rproffitt
0
171
Member Avatar for COKEDUDE

Are there any good tutorials c programming with mysql? I only found one promising link, unfortunately they neglect to to show what is in their header files which doesn't help very much. http://zetcode.com/db/mysqlc/

Member Avatar for rproffitt
0
403
Member Avatar for COKEDUDE

I have four array of strings. I would like to print out the strings with this formatting: printf(" %d \t %s \t %s \t %s \t %s.\n", quadruples_line_counter, strings_quadruples1_action[0], strings_quadruples2_variable1[0], strings_quadruples3_variable2[0], strings_quadruples4_temp_variable[0]); It gives this output: 17 func sub int 3. 17 param (null) (null) (null). 17 alloc 4 (null) …

Member Avatar for rproffitt
0
436
Member Avatar for COKEDUDE

In the str char array below I would first like to locate the first math symbol I see, then I would like to count backwards and remove whatever is between the previous three " _ " and remove the three " _ ". Can I please get some ideas on …

Member Avatar for AssertNull
0
259
Member Avatar for COKEDUDE

How does this compile? I forgot to set my second condition in my second for loop and it compiles. if(cmp_str5 == 0 || cmp_str6 == 0) { if(cmp_str5 == 0 || cmp_str6)

Member Avatar for Reverend Jim
0
176
Member Avatar for COKEDUDE

I am trying to add an int to a Multi-dimensional char Array. After reading the link below I would think I can use sprintf. If I can't use sprintf what is another way I can do this? http://www.cplusplus.com/reference/cstdio/sprintf/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, char …

Member Avatar for AssertNull
0
320
Member Avatar for COKEDUDE

How would I go about making this table? ID Type Value X int 4 Y int 4 Z float 0 This is the only way I can think of but I don't think this will work. int main(int argc, char *argv[]) { char *strings_line1[3] = {"ID", "TYPE", "Value"}; char *strings_line2[3] …

Member Avatar for rubberman
0
190
Member Avatar for COKEDUDE

My understanding of code blocks is that it uses gcc. So I am curious why gcc allows you to have a function called itoa, but code blocks does not let you have a function called itoa. Does anyone know?

Member Avatar for rproffitt
0
225
Member Avatar for COKEDUDE

I always get confused with while when I need to use multiple condition. I believe this is correct. 1 and 1 = 1 1 and 0 = 0 1 or 1 = 1 1 or 0 = 1 Is there something special I need to do with while loops? If …

Member Avatar for David W
0
184
Member Avatar for COKEDUDE

Is this the correct way to print char*? *I know c has the value I want because of the print statement below it. The o is not giving the value that I expect. char out[50]; char *o = out; int i = 118; *o++ = c; printf("o is %d (%c)\n", …

Member Avatar for tinstaafl
0
164
Member Avatar for COKEDUDE

I am trying to get the first value of a null initialed array of string.I have tried every method I can think of with no luck. I either get warning, errors, or a segmentation fault. Whats the correct way to print the null value and use it in the if …

Member Avatar for tinstaafl
0
464
Member Avatar for COKEDUDE

In this example in the malloc() what does the UL do? #include <stdio.h> /* perror */ #include <errno.h> /* errno */ #include <stdlib.h> /* malloc, free, exit */ int main(void) { /* Pointer to char, requesting dynamic allocation of 2,000,000,000 * storage elements (declared as an integer constant of type …

Member Avatar for Soft_1
0
185
Member Avatar for COKEDUDE

I have seen a few different ways of doing malloc error checking? Is one way better than the other? Are some exit codes better than others? Is using fprintf with stderr better than using a printf statement? Is using a return instead of an exit better? ptr=(int*)malloc(n*sizeof(int)); //memory allocated using …

Member Avatar for Soft_1
0
739