fgets(ex_str, sizeof ex_str, stdin);
reads input from standard input and stores it in ex_str, the sizeof ex_str argument ensures no overflow occurs.
from code it looks like your trying to read...
Type: Posts; User: peterchen
fgets(ex_str, sizeof ex_str, stdin);
reads input from standard input and stores it in ex_str, the sizeof ex_str argument ensures no overflow occurs.
from code it looks like your trying to read...
i don't see anything wrong, so it might be your ide.
try running this
#include <stdio.h>
int main(int argc, char *argv[]) {
int lines = 0;
post agenda.dat so i can do some tests
"hard to solve" sure got my attention.
i had the exact same problem when i first looked into c.
this has already been answered go to link below
http://cboard.cprogramming.com/showthread.php?t=87167
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 30
struct ValueList
{
char valuename[MAX]; /* change valuename to value */
struct ValueList *value; /*...
e.g
char *func(char a[], char b[]) {
int i=0;
while(*b!='\0') {
*(a+i)=*b;
b++;
i++;
}
you know grumpy is right
the mistakes you have made are easy to fix if you just go through it. the code isn't that long and the same mistakes are made over and over again.
for example
...
where is main? (will make much easier to debug)
is length synonym to number_of_players?
why length = 20? (it's pointless because of what comes next)
you will need malloc(size_t); to achieve what...
you need to get sweepValue a value before using it in an expression.
e.g float sweepValue = 0;
also delay doesn't seem to have been defined.
1. the function names should be different to the array names. that is change the function names
2. change
int b;
for (b=0;b<a;b++)
(c+b)=*(d+b);
sorry about that.
try fgets(char_array, max_number_char, sdtin)
as vart pointed out.
or put
getchar();
which removes '\n' from stdin
regarding
float a = 0.7f;
if(a == 0.7f)
printf("First");
else
printf("Second");
note just realized it doesn't work for negative nums
try %[^\n] instead of %s
scanf("%s", char_array_name);
stores the characters from stdin into char_array_name until white space is encountered.
scanf("%[^\n]", char_array_name);
stores the...
Those questions are the fundamentals of C.
It would be bad for you if i told you the answers.
However, i will point you in the right direction.
-->...
no it would not
simply because the arguments to strcmp needs to be char *
if you want to compare variables that are characters simply use the relational operators ==, !=, >, <, >= or <= as you...
look at the function definition for fopen.
FILE *fopen(const char *FILE, const char *MODE);
the second argument to fopen is string pointer.
if you put r,w or rw the complier thinks it is a...
you need to initialize sum to zero aswell
1. 42339 is not a 6 digit number
2. if you multiply each digit by 2 you get 5 numbers 8 4 6 6 18 where did the other 6 come from.
not a very good specification.
check if the number is between 9999
and 100000 exclusive
if(input > 9999 && input < 100000) {
/* your code continues */
a better way is to store the input as a string instead of an...
the two string functions strcpy and strcmp are completely different functions.
the difference is strcpy copies a string to an array, whereas strcmp compares the two strings for order.
for...
you need to know that '1' is not equivalent to 1.
see this link: http://www.lookuptables.com/
'1' is a character represented in ansii and has a corresponding int value - 49. so c == '1' is same...
if i'm not mistaken, two consecutive newline characters is a blank line.
#include <stdio.h>
void alphabet(char *);
int main(void) {
alphabet("a");
system("PAUSE");
return 0;
}