No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I'm trying to sum command-line integers. My total is constantly 473. I dont know how to get the right total. [CODE]#include <stdio.h> 4 #include <stdlib.h> 5 #include <ctype.h> 6 7 #define MAX 100 8 9 void sum(char *a, int n); 10 11 main (int argc, char *argv[]) 12 { 13 … |
|
[CODE] #include <stdio.h> 5 6 #define MAX 100 7 8 int main(void) 9 { 10 char msg1[MAX], *p, *q, msg2[MAX]; 11 12 printf("Enter a message: "); 13 for (p=msg1; p<msg1+MAX; p++) 14 { 15 *p=getchar(); 16 if (*p=='\n') 17 break; 18 } 19 20 for (p--; p>=msg1; p--) 21 { … |
|
I am having troubles getting my program to work. It is supposed to take integers from a file and put them into an array. Then it is supposed to sort them by the bubble sort algorithm. [CODE]#include <stdio.h> #include <ctype.h> #include <stdlib.h> #define N 10000 int main(int argc, char *argv[]) … |
|
I am not sure what this means and I get it all the time. Can someone help me fix this code? [ char add_account(account_t a[]) 7 { 8 int i, N=1000000; 9 char ch; 10 char str1, str2; 11 int m=20; 12 13 for(i=0;i<N;i++) 14 { 15 if(a[i].number==0) 16 { … |
|
I am brand new to all this and I can't get my program to read the file from input. Here is my code. It says segmentation fault (core dumped) I'm assuming because fp is not getting the file information. Can anyone help? [code]#include <stdio.h> #include <ctype.h> #include <stdlib.h> #define getchar() … |