Search:

Type: Posts; User: Tom Bombadil

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    49
    Views
    14,414

    As MK27 said the Struct is not properly defined, ...

    As MK27 said the Struct is not properly defined, missing curly braket at the end



    The main function is think is not now defined correctly can you confirm this MK27?
  2. Replies
    6
    Views
    2,126

    I am just a beginner at C so perhaps this is...

    I am just a beginner at C so perhaps this is irrelevant.



    int x =6;
    int *p=&x


    should you not initialise the pointer like this:
  3. matsp, thanks for taking the time to respond. I...

    matsp, thanks for taking the time to respond. I will have to digest what you have said and try to fix things later. I should get back to my work, unfortunately!
  4. You want me to post the code again? ...

    You want me to post the code again?




    #include<stdio.h>
    #include<stdlib.h>
    #include<time.h>
    #include<string.h>
  5. Everything works now. I have learnt my lesson...

    Everything works now. I have learnt my lesson the declare the function prototypes AFTER the structure if they are calling them...

    When I run the program I get this:
    ...
  6. I am blind! sorry matsp, i completely missed...

    I am blind!

    sorry matsp, i completely missed that and thanks also MK27 and Brafil
  7. a quick update with the errors I am having...

    a quick update with the errors I am having problem solving:

    qa@qa:~/Programming$ gcc -o struct_callsFUNC struct_callsFUNC.c
    struct_callsFUNC.c:7: warning: \u2018struct CALL\u2019 declared inside...
  8. also I get an error here, when trying to write to...

    also I get an error here, when trying to write to the file:



    if (nf != NULL) {
    fwrite(&c, 1, sizeof(CALL), nf);
    fclose(nf);
    }
  9. struct_callsFUNC.c: In function \u2018main\u2019:...

    struct_callsFUNC.c: In function \u2018main\u2019:
    struct_callsFUNC.c:56: warning: passing argument 1 of \u2018createFile\u2019 makes integer from pointer without a cast
    struct_callsFUNC.c:56:...
  10. You mean in my function prototype and function...

    You mean in my function prototype and function have : struct CALL c instead of struct call:



    void createFile(char filename, struct CALL c);


    is the function call :
  11. problem getting structure to work in my function

    Hello folks,

    I hope my question is not wasting anyones time here. I was trying to make a program that will assist me in my daily work, the idea being to automatically generate a file that...
  12. solved it!

    solved it!
  13. how to make function return value go to structure record

    Hello,

    I have a question in regards to how do I make a function return value go to a specific record of a structure.

    I have tried a few ways to do this but can't seem to see how to do it. ...
  14. Replies
    10
    Views
    2,167

    Understood, thanks, much appreciate matsp.

    Understood,

    thanks, much appreciate matsp.
  15. Replies
    10
    Views
    2,167

    So this is the correct way?: char...

    So this is the correct way?:



    char *stringp = "String";
    char *stringp2;

    char ch[7];

    stringp2 = &ch;
  16. Replies
    10
    Views
    2,167

    It compiles but gives me a segmentation fault.

    It compiles but gives me a segmentation fault.
  17. Replies
    10
    Views
    2,167

    tabstop why can I not define it as: char...

    tabstop why can I not define it as:



    char *stringp2;


    For an empty string or something...
  18. Replies
    10
    Views
    2,167

    copying pointers

    I am practicing with pointers presently, trying to get my knowledge on the matter more robust.

    I created one program that just uses 2 points and another that uses on string and one array.

    Both...
  19. Thanks everyone, got it working now. Didn't...

    Thanks everyone, got it working now. Didn't see all the other replies posted before my last post!

    Much appreciated :D

    And i will try to indent my C code better too. Enjoy the rest of...
  20. Thanks matsp: char *genCallNr(){ char...

    Thanks matsp:



    char *genCallNr(){
    char callnr = malloc(12);
    time_t now;
    struct tm *ts;
    char buf[12];
    //char callnr[11];
  21. Thank you MK27 I corrected the things that you...

    Thank you MK27

    I corrected the things that you pointed out. However things don't run smoothly.
    I managed to get the code from the VMware:



    #include<stdio.h>
    #include<stdlib.h>...
  22. error while call function that returns a string to a structure

    I am a beginner to C programming. I have done a few programs here and there and am also following the book 'The C programming language' by K&R.


    The program consists of 2 parts: the main and 1...
  23. Replies
    6
    Views
    11,615

    Also got it working for arrays. Great. Thanks...

    Also got it working for arrays. Great.

    Thanks again!
  24. Replies
    6
    Views
    11,615

    Thanks you vart, much appreciated. It worked...

    Thanks you vart, much appreciated. It worked with a single object, will try with an array of structures now.
  25. Replies
    6
    Views
    11,615

    setting structure char array with string

    Hello,

    sorry if this seems like a trivial query but I was having some issue setting a string to a char array in a structure. I have a set up like this:




    typedef struct
    {
    int date; char...
Results 1 to 25 of 37
Page 1 of 2 1 2