Command Line Argument n C

First Programme
The program execution begins by executing the function main ().

#include <stdio.h>
main(){
  printf("Amber \n");
}
 
OUTPUT:
Amber
 

C LANGUAGE KEY WORD
auto         double      int           struct
break       else          long         switch
case         enum       register     typedef
char         extern      return       union
const       float        short         unsigned
continue   for          signed       void
default     goto        sizeof        volatile
do            if             static         while
****MAIN FUNCTION IN C***********
In all C programs, the starting point is the main() function.
Every C program has one.
#include <stdio.h>
int main()
{
    printf("Goodbye!\n");
    return(0);
}
OUTPUT:
Goodbye!
**********List the command line arguments****#include <stdio.h>
int main(int argc, char *argv[])
{
  printf("Program name: %s\n", argv[0]);
  int i;
  for(i = 1 ; i<argc ; i++)
    printf("\nArgument %d: %s", i, argv[i]);
  return 0;
}
///////////////Static Variable//////////////
#include <stdio.h>
int g = 10; 
main(){

    int i =0;
    void f1();
    f1();           
    printf(" after first call \n");
    f1();           
    printf("after second call \n");
    f1();           
    printf("after third call \n");

}
void f1()
{
    static int k=0; 
    int j = 10;            
    printf("value of k %d j %d",k,j);
    k=k+10;
}
 
/////////Static versus automatic variables/////////////
#include <stdio.h>
void test1(void){
  int count = 0;
  printf("\ntest1   count = %d ", ++count );
}
void test2(void){
  static int count = 0;
  printf("\ntest2   count = %d ", ++count );
}
int main(void)
{
  int i;
  for(i = 0; i < 5; i++ )
  {
    test1();
    test2();
  }
  return 0;
}
::::::::VARIABLE ADDRESS::::::::
//////////Output address and value//////////
#include <stdio.h>
int main(void)
{
  int number = 0;                
  int *pointer = NULL;           

  number = 10;
  printf("\nnumber's address: %p", &number);            /* Output the address */
  printf("\nnumber's value: %d\n\n", number);           /* Output the value   */

  return 0;
}
///////////Using the & operator///////////
#include<stdio.h>
int main(void)
{
  long a = 1L;
  long b = 2L;
  long c = 3L;

  double d = 4.0;
  double e = 5.0;
  double f = 6.0;

  printf("A variable of type long occupies %d bytes.", sizeof(long));
  printf("\nHere are the addresses of some variables of type long:");
  printf("\nThe address of a is: %p  The address of b is: %p", &a, &b);
  printf("\nThe address of c is: %p", &c);
  printf("\n\nA variable of type double occupies %d bytes.", sizeof(double));
  printf("\nHere are the addresses of some variables of type double:");
  printf("\nThe address of d is: %p  The address of e is: %p", &d, &e);
  printf("\nThe address of f is: %p\n", &f);
  return 0;
}

Comments

Popular posts from this blog

Error : DependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.adobe.aem:uber-jar:jar:apis -> version 6.3.0 vs 6.4.0

ERROR Exception while handling event Sitecore.Eventing.Remote.PublishEndRemoteEventException: System.AggregateExceptionMessage: One or more exceptions occurred while processing the subscribers to the 'publish:end:remote'

Error : Sorry, there was an error : unauthorized_client in Sitecore 9.1 login