Search:

Type: Posts; User: BillyTKid

Page 1 of 10 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    1,109

    Post the full example code. Make sure, that you...

    Post the full example code.
    Make sure, that you use a C compiler not a C++ compiler.
  2. Replies
    7
    Views
    1,109

    You should include the declarations for both...

    You should include the declarations for both lib-functions in your code, put

    #include <math.h>
    at the begin of your sourcefile.
  3. Can you read? VLA are not supported by...

    Can you read?

    VLA are not supported by C++98,C++03,C++11, therefore VLA are not compatible with C++.
  4. Replies
    6
    Views
    1,044

    You should pass char-Array to your function, you...

    You should pass char-Array to your function, you should never return an lokal automatic variable to the calling context, try:


    int main(void)
    {
    char integer[INT_SIZE+EXTRA_SPACES];
    int...
  5. You should never use VLA, VLA are bad, only C99,...

    You should never use VLA, VLA are bad, only C99, without error-handling and not C++ compatible.



    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #define MAXWORDNUM 90000...
  6. Replies
    13
    Views
    1,859

    The best way to read 'words' (separated by...

    The best way to read 'words' (separated by whitespaces) from a stream is fscanf, and to implement a dynamic array you can use realloc like:


    int main(){
    FILE *fp;
    char buffer[50];
    char...
  7. Replies
    13
    Views
    1,859

    #define MAXLINESIZE 50 #define MAXLINES 100 int...

    #define MAXLINESIZE 50
    #define MAXLINES 100
    int main(){
    FILE *fp;
    char buffer[MAXLINESIZE];
    char *words[MAXLINES]; /* define enough space for max. 100 StringPOINTERS */
    int i=0;
    ...
  8. Replies
    2
    Views
    1,022

    You should use the %n format in sscanf like ...

    You should use the %n format in sscanf like


    while(i < NUM_SKATER && fgets(buffer, sizeof(buffer), fpIn))
    {
    sscanf(buffer,"%20[^\n]", skater[i].name);
    for(k...
  9. Replies
    5
    Views
    604

    If you includes ctype.h you can use isdigit...

    If you includes ctype.h you can use isdigit instead of your wrong line 32.
  10. Replies
    6
    Views
    899

    I know what i say.

    I know what i say.
  11. Replies
    6
    Views
    899

    You are wrong. You can only specify the size of...

    You are wrong.
    You can only specify the size of a classic array at compile time, you cannot it at runtime.
    At runtime you can specify the size of an VLA (only C99).
    Instead of an array you can use...
  12. Replies
    6
    Views
    1,823

    Recursion its another option: void rev(char...

    Recursion its another option:

    void rev(char *o,char *s,int i)
    {
    char t[100];
    int n;
    if( i-- && 1==sscanf(s,"%s%n",t,&n) )
    {
    rev(o,s+n,i);
    if(*o)
  13. Replies
    4
    Views
    3,234

    You should redefine the elements in your type...

    You should redefine the elements in your type user with as array of char array and not array of char pointers.

    #include <stdio.h>
    #include <stdlib.h>
    #include <strings.h>
    #define buffer_size 512
  14. Replies
    22
    Views
    13,637

    Its horrible code, which value has x in int...

    Its horrible code, which value has x in

    int menu_function(int x)
    {
    while(x!=sentinel)
    if you call menufunction() without(!) any argument?
    Do you read your compiler warnings? I think not.
  15. Replies
    4
    Views
    705

    Where do you allocate memory for your structs?

    Where do you allocate memory for your structs?
  16. for(i = month+1;i < month_1 - 1;++i); /*

    for(i = month+1;i < month_1 - 1;++i); /* <<-- here is your newbie mistake */
    days_total += daysinmonth(i);
    days_total += days_1;
    return days_total;
    }
  17. Replies
    4
    Views
    517

    Oh my god, please read a good C book. Try: ...

    Oh my god, please read a good C book.
    Try:

    char line[100];
    int i;
    while (fgets(line, 100, in) != NULL)
    {
    for(i=0; line[i]!='\0'; ++i)
    {
    switch (line[i])
  18. Replies
    2
    Views
    623

    Where do you call evaluate? #include ...

    Where do you call evaluate?

    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>

    #define STACK_SIZE 20

    void push(int* stack, int* top, int element);
    int pop(int* stack, int* top);
  19. Replies
    7
    Views
    839

    Your 'printArray' function open the file for...

    Your 'printArray' function open the file for reading ("r").
  20. Replies
    4
    Views
    1,455

    1.0 will ever interpreted as double (C standard),...

    1.0 will ever interpreted as double (C standard), therefore there are specifiers l or L for long double and f or F for float.
  21. It should be fgets(... LINES ...) or fgets(......

    It should be fgets(... LINES ...) or fgets(... sizeof(buffer) ...) and not fgets(... sizeof(LINES) ...).
  22. Replies
    3
    Views
    10,498

    First is right. You don't need a break here.

    First is right. You don't need a break here.
  23. Replies
    11
    Views
    4,520

    The compiler is right, there is a difference...

    The compiler is right, there is a difference between posQuadracticEquation and posQuadraticEquation.
  24. Replies
    4
    Views
    3,060

    Thats wrong. No tab is needed in formatstring,...

    Thats wrong.
    No tab is needed in formatstring, each %d in scanf will eat all heading whitespaces.
  25. Replies
    5
    Views
    4,824

    gets(s1) is unsafe when user input more than 79...

    gets(s1) is unsafe when user input more than 79 chars
Results 1 to 25 of 233
Page 1 of 10 1 2 3 4