15,552 Topics
| |
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"); | |
Hello, this is my first post here. I'm playing around with Gtk+ and Xlib. I'm trying to get the X window ID of the active window, and then display that ID in a Gtk label. However, when I run it, it seg faults. I've narrowed it down to `XGetInputFocus`, but … | |
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? | |
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 … | |
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) { } | |
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 … | |
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"); | |
I can't slove this problem my code print nothing what's wrong with it ?? #include <stdio.h> #include <string.h> #include <ctype.h> #define total 1000 int weight (char word[total]) { int i; int sum; for (i=0;word[i]!='\0';i++) { sum+=i; } return sum; } char *getword (char temp[total]) { static char max[total]={'\0'}; int lenth,maxlenth; … | |
When using fgets to read from stdin how do you stop reading from stdin? | |
I am using Mplab x Ide with v3.61 on Xc8 compiler, PIC18F24K40. I used MCC generated UART code for send and receive data. For understanding I am clubling my code and posting part of it. My main code look like this #include "mcc_generated_files/mcc.h" #define EUSART_TX_BUFFER_SIZE 8 #define EUSART_RX_BUFFER_SIZE 8 /** … | |
i made a property tax program but now i have to use it with pointers. i have to use 3 functions inputtotalsales,calculatetaxes,and displaytaxes.It was easy for me to do this the regular way but im having an issue with pointers . im getting errors saying redeclaration of statetax and countytax … | |
testing of independece of attributes by chi square method ,,please write a c code for this. | |
My program find the amount of specific word such as "whale" and "thee", but ignore "thee,", "whale....", and so on. How can I contain them? #include<stdio.h> #include<string.h> #include<ctype.h> int main(){ FILE *md,*out; char CHA[255]; char cha[255]; cha[255]=tolower(CHA[255]); char thee[]="thee"; char chapter[]="chapter"; char whale[]="whale"; char meet[]="meet"; int th=0; int ch=0; int … | |
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); } … | |
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) … | |
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? | |
I wrote the code that using txt file, but error "0 [main] assignment4 16012 cygwin_exception::open_stackdumpfile: Dumping stack trace to assignment4.exe.stackdump" is only thing that printed to console. Here is my code. #include <stdio.h> int main() { FILE *fp; char buff[255]; fp = fopen("moby_dick.txt", "r"); printf("%c\n", fgetc(fp)); fscanf(fp, "%s", buff); printf("1 … | |
So, I'm relatively new to programming and I'm working on a program that allows for input of grades, course hours, and then calculates GPA based on that. But, I'm going step by step, the first thing I'm trying to do is ensure that I can input the data so that … | |
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/ | |
typedef struct{ int*p; }new; void main(){ new *buffptr=malloc(sizeof(new)); buffptr->p; } my doubt is the above declaration in main function accesses the value of p and not the address of p. If I want to increment the address of p what should I do? | |
Write a C++ program that takes in text from the user and prints the total Number of spaces used in the text. Kindly, use #include<iostream> and #include<conio.h> only. while loop is more preferable than for or do-while. | |
I made first board, but when I use function next_generation, it prints wrong result. For example, since first board is 01000 00100 11100 00000 00000, next one should be 00000 10100 01100 01000 00000 . But my program prints 00000 00100 01100 00000 00000. Here is my code. #include <stdio.h> … | |
gerard4143 explained 6 years ago how to store binary code in memory and then execute it. See https://www.daniweb.com/programming/software-development/threads/353077/store-binary-code-in-memory-then-execute-it#post1500738. In the example, we create an array of unsigned char containing these values: 0x50,0x57,0x56,0x52,0xe8, 0x00,0x00,0x00,0x00,0x5e, 0x48,0x81,0xc6,0x24,0x00, 0x00,0x00,0x48,0xc7,0xc0, 0x01,0x00,0x00,0x00,0x48, 0xc7,0xc7,0x01,0x00,0x00, 0x00,0x48,0xc7,0xc2,0x0e, 0x00,0x00,0x00,0x0f,0x05, 0x5a,0x5e,0x5f,0x5a,0xc3, 0x48,0x65,0x6c,0x6c,0x6f, 0x2c,0x20,0x57,0x6f,0x72, 0x6c,0x64,0x21,0x0a,0x00 This works fine when I use the … | |
I am making a bank program with functions.1 called displaymenu that produces a menu d(make deposit),w(make withdraw),b(check balance) and q(quit).2nd function is getdeposit which accepts balance as parameter and asks user for amount they want to deposit then add amount to balance and return it to main function.3rd getwithdrawal same … | |
Hi, I'm trying to make a program that sets up the hight dpi compatibility mode programatically on Windows 10, so that I don't have to set up manually the properties of every legacy *.exe program I use, there are hundreds. When you set up that on a local drive, Windows … | |
So i'm in the process of learning about functions and I'm not grasping the full operation of them. I have a menu in which I have utilized a function but I want to create a fucntion for each of the menu options. I've heard of pointers but I haven't researched … | |
class space { public static void main(String args[]) { int i; for(i=0;i<5;i++) { System.out.print("*"); System.out.print("_"); } } for(i=0;i<5;i++) { System.out.println("*"); } } | |
Hello i'm working on this piece of code and I have the idea how it should be. But I believe my assignment is base on boath C and shall formating command to create a menu. The code is working so far fine but in order to move on furthur. I … | |
simulate enter button with c language pls help me |
The End.