Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.
/ 42-printf Public archive

We are replicating the behavior of the printf function in c language

Notifications You must be signed in to change notification settings

MaazBinNaseer/42-printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

42-printf

image image

We are replicating the behavior of the printf function in c language

Important Functions to look into: Variable Arguments

// va_list is a type to hold information about
    // variable arguments
    va_list ap;
  
    // va_start must be called before accessing
    // variable argument list
    va_start(ap, arg_count);
  
    // Now arguments can be accessed one by one
    // using va_arg macro. Initialize min as first
    // argument in list
    min = va_arg(ap, int);
  
    // traverse rest of the arguments to find out minimum
    for (i = 2; i <= arg_count; i++)
        if ((a = va_arg(ap, int)) < min)
            min = a;
  
    // va_end should be executed before the function
    // returns whenever va_start has been previously
    // used in that function
    va_end(ap);

About

We are replicating the behavior of the printf function in c language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published