Search:

Type: Posts; User: jas_atwal

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Thread: C functions

    by jas_atwal
    Replies
    3
    Views
    1,066

    All you need to do is put the function in one...

    All you need to do is put the function in one file and include it in the main file using "include" keyword. An example is below where we have two files mainfile.c and func.h. func.h will have the...
  2. Thank you. But I assume that is not a standart C...

    Thank you. But I assume that is not a standart C function. It is included in conio.h in windows. Is there a smiliar implimentation for linux/unix systems as well?

    Maybe curses.h. I'll try that.
  3. display a char at a particular co ordinates on screen

    I want to display a character at specific positions on screen using values like x and y. Is it possible?? i am not able to find the correct function. I tried to google but no luck.
  4. Replies
    2
    Views
    1,262

    how to display a string

    cout << "String is "<< color;


    In the above code color is a string. Would it work? what is the correct syntax to output a string to screen?
  5. Replies
    3
    Views
    5,422

    is error_exit a valid command?

    Hi guys,

    I wrote the following code:


    #!/bin/sh

    echo this is simply to demonstrate the use of error_exit
    error_exit i am exiting..
    echo this won't be displayed
  6. Replies
    6
    Views
    1,315

    That surely is an excellent command to start...

    That surely is an excellent command to start with. But as it invokes a new shell to execute a command, it may be slow to execute.
    Instead you should functions from unistd.h
  7. Replies
    3
    Views
    5,528

    Time To Live in a IP header

    This is a sanity check. An IP packet has a TTL field of 8 bits. that means a count of 256. That means an IP packet can traverse 256 hops before it is dropped? isn't that a too large value for real...
  8. Replies
    8
    Views
    5,731

    Yes, you are very correct. it is Integer...

    Yes, you are very correct. it is Integer overflow. I tried to use long type instead of int in hope that i may be able to increase this limit from 16 to a little more. But did not work.
    Anybody...
  9. Replies
    4
    Views
    1,361

    I am able to compile it.

    I am able to compile it.
  10. Replies
    8
    Views
    5,731

    factorial for values greater than 16

    I have the below program to calculate factorial. It is working good for values upto 16. But when I give a value greater than 16, like 17 the output is in negative. e.g for 17 i get -288522240. Why is...
  11. Replies
    4
    Views
    1,361

    function declaration.

    I understand that in C we need to define every function that we are going to use before main function calls it. e.g:


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

    int square(int);

    main() {
    int...
  12. Replies
    4
    Views
    1,851

    Following version of your program is working fine...

    Following version of your program is working fine with gcc( if we ignore a few warnings that it through):


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

    int main()
    {
    int...
  13. Gotya!! THank you!!

    Gotya!! THank you!!
  14. View Post

    << split from this dead thread - http://cboard.cprogramming.com/showthread.php?t=1115 >>
    << read the rules about thread bumping! >>



    So int x has to be global all the time??
  15. Replies
    5
    Views
    5,437

    Thank you so much for your suggestion. I have...

    Thank you so much for your suggestion. I have made some changes to my code taking your suggestion:


    //This is a small program to reverse the string provided by user
    #include<stdio.h>...
  16. Replies
    5
    Views
    5,437

    Actually I did include the above in read code....

    Actually I did include the above in read code. Just skipped these to save some space :)


    Ok, good to know that!


    I am writing this just for educational/practise purpse. Thought maybe some...
  17. Replies
    5
    Views
    5,437

    reverse a string

    Hi Guys, Happy New Year to all of you!! I wrote the following code to reverse a string input from user. I'm wondering if there is a better way to go about this. Any suggestions please?



    int...
  18. Replies
    9
    Views
    2,311

    Thank you so much for your replies. Your answers...

    Thank you so much for your replies. Your answers have cleared my confusion. Have a great new year all of you!!
  19. Replies
    9
    Views
    2,311

    I agree that Array indexes are 0-based. So that...

    I agree that Array indexes are 0-based. So that means buffer[chars_read - 1] is the last character and it will be overwritten. Please correct me if I understand wrong.

    Thank you!
  20. Replies
    9
    Views
    2,311

    converting char array to string.

    Hello everybody!
    I have a query regarding the code below. Here within while loop, there is a line buffer[chars_read-1] = '\0'. Now I understand that this is being done in order to make char array...
  21. When exit() is called, the program terminates....

    When exit() is called, the program terminates. Any statement after exit want be executed at all. If you want to pass values you may use return(). e.g:




    int test(){
    return(1);
    }

    int...
  22. Replies
    1
    Views
    2,711

    threads and semaphores

    I'm using the following code to demonstarte threads and semaphores. it is works well all the way but the program hangs at the point where the threads join. They never join and program hangs there...
  23. Replies
    8
    Views
    1,033

    Thanks Mat.... now another question... what...

    Thanks Mat.... now another question...

    what would you say about a stupid mistake like the one i made above??!!!

    And..... how do you know i am using bubblesort. i haven't mentioned the filename...
  24. Replies
    11
    Views
    1,523

    and scanf will accept a pointer. so replace...

    and scanf will accept a pointer. so replace scanf("%d", a) with scanf("%d",&a);
  25. Replies
    8
    Views
    1,033

    I am so sorry for this putting this question so...

    I am so sorry for this putting this question so vaguely and in a dumb manner: Let me say this again:

    I have the following code:



    int main(void) {
    FILE *ptr;
    char buff[100];
    ptr =...
Results 1 to 25 of 54
Page 1 of 3 1 2 3