Search:

Type: Posts; User: technam

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    1,259

    Size of array unknown when compiling

    Though I haven't tried out the code, on first look, I'm suspecting your char *data[k].

    void execute(short k){
    char *data[k]; /* as k is unknown while compiling, */
    /* how...
  2. Replies
    13
    Views
    2,898

    Good work and great attitude, kasj!

    Good work and great attitude, kasj!
  3. Replies
    4
    Views
    3,632

    Why do you need extern here, first of all?

    Why do you need extern here, first of all?
  4. Thread: preprocessor

    by technam
    Replies
    5
    Views
    2,018

    Do you understand how the below program works? ...

    Do you understand how the below program works?

    #include<stdio.h>
    void main()
    {
    int i=2;
    do
    {
    if(i<3)
    printf("Have fun...","\n");
  5. Replies
    7
    Views
    22,947

    Correction

    Sorry, there is a small correction in my sample code. It struck to me just now. I gave that example without trying out (still did not try out!!), but the below assignment was what I had in mind when...
  6. Replies
    7
    Views
    22,947

    One common real life application of unions is, to...

    One common real life application of unions is, to use generate device handles or similar entities. Given below is an example, where an 8-bit demux handle is constructed bitwise, and once it is...
  7. Replies
    7
    Views
    1,590

    Hey, your recursive call coupled with if and...

    Hey, your recursive call coupled with if and increment is serving as loop only!
  8. Thread: setbits

    by technam
    Replies
    11
    Views
    5,764

    and in the first block also, (x & ((~0

    and in the first block also,
    (x & ((~0 << (p + 1)) | (~(~0 << (p + 1 - n)))))
  9. Thread: setbits

    by technam
    Replies
    11
    Views
    5,764

    Brackets

    Please check the brackets properly, I think you are calculating it wrongly :)


    return (x & ((~0 << (p + 1)) | (~(~0 << (p + 1 - n))))) | ((y & ~(~0 << n)) << (p + 1 - n));
  10. Replies
    12
    Views
    2,204

    Lesson learnt, thanks BEN10!You're welcome,...

    Lesson learnt, thanks BEN10!You're welcome, zcrself!
  11. Thread: Makefile

    by technam
    Replies
    11
    Views
    2,949

    Use separate build output directories

    I think the best option to solve the overhead of switching between release/debug build etc is to take a leaf out of the Linux kernel build system. Write the Makefiles in such a way that all .o, .a,...
  12. Thread: Makefile

    by technam
    Replies
    11
    Views
    2,949

    Alternate for smaller makefiles

    To add to brewbuck's inputs, an alternative would be something like this (if you need just a small single Makefile):

    BUILD ?= release # default build option
    CFLAGS = flags common to all builds
    ...
  13. Replies
    12
    Views
    2,204

    Oops!

    Pardon me, I'm new to a forum of this kind. Lesson learnt, by the way!
    OK, I change my tip to "start using a debugger" :-)
  14. Replies
    12
    Views
    2,204

    Practise using GDB

    I'd like to add one more point. Do practise using GDB.

    gcc -g sourcefile.c
    gdb ./a.out
    (gdb) b main [skip this gdb command if your program is big enough and you don't know where exactly your...
  15. Replies
    5
    Views
    1,628

    Try Linux command (awk)

    In case you are working on Linux, and all you need is to "figure out the number of columns and rows in these files", here's a quick command-line solution using awk:
    To get the no. of rows:
    awk 'END...
  16. Thread: why error ?

    by technam
    Replies
    4
    Views
    996

    Unallocated memory

    Please refer my post in reply to another question from you: why Segmentation fault?
  17. Replies
    12
    Views
    2,204

    Its due to incorrect memory allocation for 2d array

    I guess you are a bit confused with 1d, 2d, pointers and pointers to pointers! Since I see a double pointer, I assume you are intending to use a 2d array using pointers. And my post is based on this...
Results 1 to 17 of 17