Skip to main content

Posts

Installing Omnet in Ubuntu 10.10

To install Omnet on Ubuntu 10.10, the following are necessary Java (jdk) Gcc Compiler / G++ Compiler zlibraries and other components Here are the instructions Download Omnet from http://www.omnetpp.org/   (the latest edition is 4.1) Download the omnet-xxx.tgz file (its for linux) Open the terminal, untar it to any folder in linux (in my case it is /home/pradeepkumar/) using the following command tar zxvf omnet-xxx.tgz go to the folder by this command cd omnet-xx/ (the above command creates a folder and untar all the contents into it) execute the command ./configure you may get some errors like unavailability of packages and dependencies, execute the following command to download and install all the packages for running the following command, your machine has to be connected to the internet…. sudo apt-get install bison flex byacc zlib1g-dev tcl tk tcl8.4 tk8.4 tcl8.4-dev tk8.4-dev build-essentials libxmu-dev once ...

checking system version (for dynamic loading)...

If you encounter the following error,  checking system version (for dynamic loading)... ./configure: 1: Syntax error: Unterminated quoted string then do the following, Open the following files under ns-allinone-2.xx/ tcl: file tcl8.x.x/unix/tcl.m4 tk: file tk8.x.x/unix/tcl.m4 otcl: file otcl-1.x/configure.in In all the above files, you can find the following line system=MP-RAS-`awk ' { print $3 } '/etc/.relid'` and change the above line to (just remove the last but one single quote, remember that ‘ is different from ` you need to remove only ‘ and not `) system=MP-RAS-`awk ' { print $3 } '/etc/.relid`

C Program–Passing an entire array to a function

/* This program is to pass the entire array to a function */ #include <stdio.h> #include <conio.h> int maximum(int[],int); //function prototype, 1st parameter is array and the second is integer int main() {     int a[100],i,n,max=0;     printf("Enter the numbers");      scanf("%d",&n); //get the index number     for(i=0;i<n;i++) //get the array elements     {     scanf("%d",&a[i]);     }     max=maximum(a,n); //function call     printf("Maximum number is %d",max);     getch();     return 0; } int maximum(int b[],int a) //function implementation {     int i,max=b[0];     for(i=0;i<a;i++)     if(b[i]...

C Program–Arrays with Functions (passing Array elements to function)

/* Program to demonstrate arrays with function in which the array elements are passed as function parameters */ #include <stdio.h> #include <conio.h> void display(int); //function prototype int main() {     int a[10],i;     for(i=0;i<10;i++) //getting the array elements     {     scanf("%d",&a[i]);     }     for(i=0;i<10;i++)         display(a[i]); //call the function inside the loop, this function called for 10 times     getch();     return 0; } void display(int a) //function implementation to print the elements, here the parameter is an integer only(means we are passing the array elements) {      printf("%d",a); }

Arrays in C

Arrays in C programming starts with memory addresses. Yes the compiler handles arrays as memory addresses. Similar elements group together with a single name is called array the indexing always starts with 0 and ends at n-1 (if the size of the array is n) Array elements stores in consecutive memory location. The array elements usually stores in consecutive memory location. For example, int a[10];  //Array with size 10 the above example is an integer array with size 10 or this array can hold 10 variables. The elements starts from a[0], a[1], a[2]…..a[9], so totally there are 10 elements. Array elements values memory address location a[0] 32 600AH  (This address is called as the base address) a[1] 34 600EH a[2] 23 6012H a[3] 35 6016H a[4] 45 601AH ...