Search:

Type: Posts; User: EeeK

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,112

    What does the following means?

    struct StaffRec
    {
    char *fname;
    char *lname;
    };

    typedef struct CDRec *StaffRecPtr;

    staff createStaff(char *fname, char *lname)
    {
  2. Replies
    1
    Views
    899

    Is this the correct way...

    to get a user array of string input?



    printf("Title: ");
    scanf("%[^\n]", title);
    while(fgetc(stdin)!='\n');


    if no, can you advise what are the ways to get an array of string, eg. "C...
  3. Replies
    28
    Views
    3,560

    In dereferencing a struct pointer, I do this in...

    In dereferencing a struct pointer, I do this in or outside of an implementation file:


    x->name;

    In dereferencing a void struct pointer, I can do this in a implementation file:

    ...
  4. Replies
    28
    Views
    3,560

    Solved the above by using %[^/n] and...

    Solved the above by using %[^/n] and while(fgetc()!='\n');.

    Here's one for understanding:



    char x[3], *y;
    y = (char*)malloc(sizeof(char)*3);
  5. Replies
    28
    Views
    3,560

    Is there anyway to use scanf() to get a string...

    Is there anyway to use scanf() to get a string input with space?
  6. Replies
    28
    Views
    3,560

    Tks, quzah, solve the problem with that. How...

    Tks, quzah, solve the problem with that.

    How do I change an int variable to a string variable? Using cast? Is this the way or there's something wrong with my code?



    char line[99] = "A";
    int...
  7. Replies
    28
    Views
    3,560

    Thx Dave_Sinkula, I got the display workin.... ...

    Thx Dave_Sinkula, I got the display workin....

    Here's a new one, why does the gets() in the following code accept any inputs? The program simply skip thru it. I tried using fgets() and it's give...
  8. Replies
    28
    Views
    3,560

    while(i!=NULL) { printf("%s\t%s\t%d", x, y,...

    while(i!=NULL)
    {
    printf("%s\t%s\t%d", x, y, z);
    i = j->next;
    }


    display:
    friend chris 124
    classmate mary 321
  9. Replies
    28
    Views
    3,560

    Ok what is the difference btn char *x; x =...

    Ok what is the difference btn


    char *x;
    x = (char*)malloc(sizeof(char)*9);

    and


    char x[9];
  10. Replies
    28
    Views
    3,560

    So they are basically the same. So can I use the...

    So they are basically the same. So can I use the first and the second for fgets()? Because the middle arguments of fgets() is the buffer size. which is not define if I'm using the first and second.
    ...
  11. Replies
    28
    Views
    3,560

    What is the difference btn these 3: char*...

    What is the difference btn these 3:


    char* text;
    char *text;
    char text[99];


    The second is a char pointer and third is an array, so what is first? Can I use all of them for fgets() or only...
  12. Replies
    28
    Views
    3,560

    Yup, found out abt that but u post b4 I want to...

    Yup, found out abt that but u post b4 I want to delete the post. Nonetheless thx for the reply.
  13. Replies
    28
    Views
    3,560

    Y does I get a passing arg 2 of 'fputs' from...

    Y does I get a passing arg 2 of 'fputs' from incompatible pointer type error at the fputs() line?



    define FILENAME "x.txt"
    .
    .
    .
    fp = fopen(FILENAME, "a");
    if(fp==(FILE*) NULL)
  14. Replies
    28
    Views
    3,560

    while (cout >...

    while (cout << "Enter a number: " && !(cin >> input))
    {
    cout << "\nInvalid input" <<endl;
    cin.clear();
    cin.ignore(std::numeric_limits < int >::max(), '\n');
    }

    cout <<"You...
  15. Replies
    28
    Views
    3,560

    What's wrong with my coding?

    If I entered "run.exe x.txt" in the following code, y does the if statement is always true?



    int main(int argc, char *argv[])
    {
    if(argv[1]!="x.txt")
    {
    printf("\nPlease enter run...
  16. Replies
    1
    Views
    1,454

    An assignment problem

    Hi I've this string tokenizer assignment problem. I want to do this by myself but juz need some advise to get started.

    Given a header file with these function protoypes:


    typedef struct...
  17. Thread: argv?

    by EeeK
    Replies
    17
    Views
    2,339

    Got a prob that need some advise here, if I need...

    Got a prob that need some advise here, if I need to store a few thousands types using struct, say each type with 3 variables x, y and z?

    How many I suppose to search for a certain type using only...
  18. Thread: argv?

    by EeeK
    Replies
    17
    Views
    2,339

    Y does the program keep looping when I enter a...

    Y does the program keep looping when I enter a char as a input?



    int main()
    {
    int x;

    while(1)
    {
  19. Thread: argv?

    by EeeK
    Replies
    17
    Views
    2,339

    If I've a ADT, and I've created a function in the...

    If I've a ADT, and I've created a function in the main method to call the ADT, is that wrong? Coz I got this undefined reference compilation errors.



    include <stdio.h>
    include "adt.h"

    void...
  20. Thread: argv?

    by EeeK
    Replies
    17
    Views
    2,339

    Hi guys, thx for fast replies, very much...

    Hi guys, thx for fast replies, very much appreciated!!!

    Give Brian a break, he's afterall have gd intention. :D

    I've been getting compilation error: "parse error before xxx". What does it mean?...
  21. Thread: argv?

    by EeeK
    Replies
    17
    Views
    2,339

    argv?

    Assuming the program name is "test.exe", why the if statement is not true when I enter "test hello"?


    include <stdio.h>
    int main(int argc, char *argv[])
    {
    if(argv[1] == "hello")
    ...
Results 1 to 21 of 21