Question: Is it possible to do this? Output of a Python as input into C program.

You believe me if I say that this code before works?
Now it doesn't work. How can I make it work?

```
python -c 'print "a" ' | ./myProgram

```

Simple example for myProgram:

```
#include <stdio.h>

int main(int argc, char *argv[]){

  int i = 0;

  if(argc > 0){
    for(i; i<argc; i++){
      printf("%s\n", argv[i]);
    }
    printf("Done.");
  }
  return 0;
}

```

Answer: 
The input to your `C` code should be taken by `scanf`.

C code: `[test.c]`

```
#include <stdio.h>
int main() {
    int x;
    scanf("%d",&x);
    printf("Value is %d\n",x);
}

```

Compile:

`gcc test.c -o foo`

Python code:`[test.py]`

```
print (3)

```

Command :

`python test.py | ./foo`

Output:

`Value is 3`

Here standard input of `C code` gets changed from `keyboard` to the end of pipe.
And standard output of `python code` gets changed from `monitor` to `beginning of pipe`.

In `C` there are kernel level calls to perform this operation. Read about `close()` , `dup()` calls. I hope your concept will be cleared then. Good Luck :)

And you are actually trying to print command line arguments. But look at your command. You are not passing any arguments to `myprogram`. So, `argc = 0`.
Do this to make it work:

```
./myProgram `python -c 'print "a" '`

```

This works with argc / argv. Like Parnab said, there were no arguments given previously, as pipe puts your argument through `stdin` instead