Q:

How to rotate bits to the left and add rotated bits to the right

I'm trying to get my program to work, where I shift bits to the left and add the shifted bits to the right. For example 00111000, if you shift it 4 positions to the left, the outcome should be 10000011. How can I make this work, I know that I need to use the bitwise OR. I have added the main function below. 
#include <stdio.h>
#include <stdlib.h>

void printbits(int b){
    int i;
    int s = 8 * (sizeof b) - 1; /* 31 if int is 32 bits */
    for(i=s;i>=0;i--)
    putchar( b & 1<<i ? '1' : '0');
}

int main(){
    char dir; /* L=left R=right */
    int val, n, i;

    scanf("%d %d %c",&val, &n, &dir);
    printbits(val);putchar('\n');
    for (i=0; i<10; i++){
    if (dir=='L' || dir =='l')
      rotateLeft(&val, n);
    else
      rotateRight(&val,n);      
    printbits(val); putchar('\n');
    }
return;
}

This is the rotateLeft en rotateRight function.
#include <stdio.h>
#include <stdlib.h>

void rotateLeft(int *val, int N){
    int num = val[0];
    int pos = N;

    int result = num << pos;

}

void rotateRight(int *val, int N){
    int num = val[0];
    int pos = N;

    int result = num >> pos;

}

A:

Here is a tested and non-optimized solution to complete your source code:
void rotateLeft(int *val, int N){
    unsigned int num = val[0];
    int pos = N;

    unsigned int part1 = num << pos;
    unsigned int part2 = (num >> ((sizeof(val[0])*CHAR_BIT)-pos));

    if (N != 0) {
        val[0] = part1 | part2;
    }
}

void rotateRight(int *val, int N){
    unsigned int num = val[0];
    int pos = N;

    unsigned int part1 = num >> pos;
    unsigned int part2 = (num << ((sizeof(val[0])*CHAR_BIT)-pos));

    if (N != 0) {
        val[0] = part1 | part2;
    }
}

To prevent automatic carry during the shift right, you have to
  consider value as unsigned int.

To prevent N = 0 interference, assign the result to the entry only when (N != 0). (See remark on post ROL / ROR on variable using inline assembly in Objective-C)

