This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//taken from http://stackoverflow.com/questions/894604/passing-dynamically-allocated-integer-arrays-in-c | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define ELEMENTS 5 | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from http://beej.us/guide/bgc/output/html/multipage/morestuff.html#pt2pt | |
#include <stdio.h> | |
#include <stdlib.h> | |
void get_string(int a, char **s) | |
{ | |
printf("s in get_string is : %p\n", s); | |
switch(a) | |
{ | |
case 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef int* intPtr; | |
typedef float (*fPtr) (float, float); | |
float plus(float a, float b){return a+b;} | |
float minus(float a, float b){return a-b;} | |
float multiply(float a, float b){return a*b;} | |
float divide(float a, float b){return a/b;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// find more explanations here | |
// https://www.securecoding.cert.org/confluence/display/seccode/STR30-C.+Do+not+attempt+to+modify+string+literals | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
char *strptr = NULL, *copy = NULL; | |
strptr = "Jacob Abraham"; // this will be stored in a read only location hence cannot be modified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// its documented here in this link http://www.delorie.com/gnu/docs/gcc/cpp_21.html | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define PRINTINFO(message) print_info(__FILE__, __LINE__, __DATE__, __TIME__, message) | |
void print_info(const char* file,int line, const char* date, const char* time, const char* message) | |
{ | |
printf("FILE is : %s\n ", file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/ | |
#include <stdio.h> | |
void check_even_odd(int); | |
void check_nth_bit_is_set(int , int); | |
int set_the_nth_bit(int,int); | |
int unset_the_nth_bit(int,int); | |
int toggle_nth_bit(int, int); | |
int turn_off_the_righmost_one(int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://discuss.itacumens.com/index.php?topic=7635.0 | |
Pipelining concept in computer architecture | |
In this Module, we have three lectures, | |
1. Introduction to Pipeline Processor | |
2. Performance Issues | |
3. Branching |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
float x; | |
printf("Enter the float number:\n"); | |
scanf("%f", &x); | |
// copy and re-interpret as 32 bit integer | |
int casted_to_int = *(int*)&x;// float pointer is converted to an integer pointer and dereferenced. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.zentut.com/c-tutorial/c-linked-list/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct node{ | |
int data; | |
node* next=NULL; | |
} node; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.zentut.com/c-tutorial/c-stack-using-pointers/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct node{ | |
int data; | |
struct node* next; | |
} node; |
OlderNewer