Preview:
#include<stdio.h>
#include<fcntl.h>
#include<dirent.h>
#include<stdlib.h>
int main(){
	char dname[10];
	DIR *p;
	struct dirent *d;
	printf("Enter dircetory name:");
	scanf("%s",dname);
	p=opendir(dname);
	if(p==NULL){
		perror("cant find dircetory");
		exit(-1);
		}
		while(d=readdir(p))
			printf("%s \n",d->d_name);
		return 0;
		}
		
	
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter