C Language

C Language

+ Follow 23,211 Followers

Share

Showing 76 to 100 of 176
Sort By: 
A

Akshay 15/07/2016 in  C Language Classes

How do you list files in a directory?

0 0 4

Show previous answers

Chetan replied | 11/08/2016

I use dirent.h
DIR *dir;
struct dirent *ent;
if ((dir = opendir ("c:\src\")) != NULL)
{
/* print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL)
{
printf ("%s
", ent->d_name);
}
closedir (dir);
}
else
{
/* could not open directory */
perror...  more»
I use dirent.h
DIR *dir;
struct dirent *ent;
if ((dir = opendir ("c:\src\")) != NULL)
{
/* print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL)
{
printf ("%s
", ent->d_name);
}
closedir (dir);
}
else
{
/* could not open directory */
perror ("");
return EXIT_FAILURE;
}
It is just a small header file and does most of the simple stuff you need without using a big template-based approach. «less

0 0

Punit replied | 11/08/2016

for this you have to include "dirent.h"header file. This header file contains opendir() function which set and refers to directory , readdir() - reading file from directory and closedir() - closed open connection

0 0

Answer

You can add upto 6 Images

M

Maliha 15/07/2016 in  C Language Classes

How do you determine a file's attributes?

0 0 3

Show previous answers

Ganesh replied | 06/08/2016

use opendir(),closedir()

0 0

Punit replied | 11/08/2016

The stat() function shall obtain information about the named file in C

0 0

Answer

You can add upto 6 Images

M

Medha 15/07/2016 in  C Language Classes

What is the notation in C Programming?

0 0

G Venkat replied | 22/07/2016

program:- the set of programs are used to perform some task is called program.

0 0

Manvendra Singh replied | 05/08/2016

You use %a to get a hexadecimal representation of a floating-point number. This might be useful if you are a student learning floating-point representations, or if you want to be able to read and write an exact floating-point number with no rounding error (but not very human-readable).

This format specificier, along with many others, was added as part of the C99 standard....  more»
You use %a to get a hexadecimal representation of a floating-point number. This might be useful if you are a student learning floating-point representations, or if you want to be able to read and write an exact floating-point number with no rounding error (but not very human-readable).

This format specificier, along with many others, was added as part of the C99 standard. Dinkumware have an excellent C99 library reference free online; it's PJ Plauger's company, and he had a lot to do with both C89 and C99 standard libraries. Link above is to printing functions; «less

0 0

Answer

You can add upto 6 Images

A

Abishiek 15/07/2016 in  C Language Classes

What are the standard predefined macros?

0 0

Sanchit replied | 27/07/2016

The standard predefined macros are specified by the relevant language standards, so they are available with all compilers that implement those standards. Older compilers may not provide all of them.

0 0

Brajesh replied | 30/07/2016

Predefined Macros

Visual Studio 2015 Other Versions

Lists the predefined preprocessor macros for standards support, and Microsoft-specific predefined preprocessor macros.
The compiler recognizes the required predefined preprocessor macros specified by the ANSI/ISO C99 standard and the ISO C++17 standard. The Microsoft C++ implementation provides several...  more»
Predefined Macros

Visual Studio 2015 Other Versions

Lists the predefined preprocessor macros for standards support, and Microsoft-specific predefined preprocessor macros.
The compiler recognizes the required predefined preprocessor macros specified by the ANSI/ISO C99 standard and the ISO C++17 standard. The Microsoft C++ implementation provides several more. These preprocessor macros take no arguments and cannot be redefined. Some of the predefined macros are defined with values that are specific to the build environment or the specified compiler options.
Standard predefined identifier
The compiler supports this predefined identifier specified by ISO C99 and ISO C++11.
__func__ The unqualified and unadorned name of the enclosing function as a function-local static const array of char.
void example(){
printf("%s
", __func__);
} // prints “example”
Standard predefined macros
The compiler supports these predefined macros specified by the ISO C99 and ISO C++17 standards.
__cplusplus An integer literal value when compiling a translation unit as C++. Otherwise undefined.
__DATE__ The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy. The month name Mmm is the same as the month name for dates generated by the library function asctime declared in (time.h) headerfile. The first character of dd is a space if the value is less than 10.
__FILE__ The name of the current source file. __FILE__ expands to a character string literal. To ensure that the full path to the file is displayed, use -FC (Full Path of Source Code File in Diagnostics).
__LINE__ The line number in the current source file. The line number is an integer constant. It can be changed by using a #line directive.
__STDC__ Defined as the integer literal constant 1 only when compiling a translation unit as C and if the /Za compiler option is given. Otherwise, undefined.
__STDC_HOSTED__ The integer constant 1 if the implementation is a hosted implementation, one that supports the entire required standard library. Otherwise, the integer constant 0.

__STDCPP_THREADS__ Defined as the integer constant 1 if and only if a program can have more than one thread of execution. Otherwise undefined.
__TIME__ The time of translation of the preprocessing translation unit. The time is a character string literal of the form hh:mm:ss, the same as the time generated by the library function asctime. «less

0 0

Answer

You can add upto 6 Images

A

Ankit 15/07/2016 in  C Language Classes

How do you redirect a standard stream?

0 0

Harish replied | 03/08/2016

We can use the C function freopen() for the same.
Example- fp = freopen("file.txt", "w+", stdout);
The above statement stores everything written on standard output in the file "file.txt"

0 0

Dishaapro replied | 04/08/2016

Thank You for the question Ankit...
By using the standard C library function freopen() you can redirect a standard stream.
Thanks,
Team DishaaPro
http://www.dishaapro.com

0 0

Answer

You can add upto 6 Images

N

Navneet 15/07/2016 in  C Language Classes

How do you view the PATH?

0 0

Satbeer replied | 03/08/2016

In linux through "$ echo $PATH" can view path

0 0

Umesh replied | 05/08/2016

echo $PATH or open the .profile fie where we can see the definition of PATH variable

0 0

Answer

You can add upto 6 Images

N

Nandini 15/07/2016 in  C Language Classes

How can I read and write comma-delimited text?

0 0

Sundeep replied | 05/08/2016

Comma-delimited means that all data (with the exception of numeric data) is surrounded by
double quotation marks ( ) followed by a comma. Numeric data appears as-is, with no surrounding double quotation marks. At the end of each line of text, the comma is omitted and a newline is used.
To read and write the text to a file, you would use the fprintf() and fscanf() standard...  more»
Comma-delimited means that all data (with the exception of numeric data) is surrounded by
double quotation marks (“”) followed by a comma. Numeric data appears as-is, with no surrounding double quotation marks. At the end of each line of text, the comma is omitted and a newline is used.
To read and write the text to a file, you would use the fprintf() and fscanf() standard C library functions. «less

0 0

Sg replied | 05/08/2016

use strtok function

0 0

Answer

You can add upto 6 Images

N

Nagam 30/05/2016 in  C Language Classes

C language course is how many days

0 0

Sanjeev replied | 12/06/2016

If you already know a programming language then it shouldnt take more than 7 days to pickup with practice.
If you are new.. you need to put atleast a month or two with regular practice.

0 0
S

Shashiraja replied | 13/06/2016

The basic topics of C could be taught in 1-2 weeks of time. However if we go to OS level in C then it takes lot longer. So timing depends on the course content.

0 0

Answer

You can add upto 6 Images

S

Show previous answers

Ekta replied | 25/07/2016

Create table using create table statement. Constraints used must be of primary key on student registration no. , Age limit can be set using range constraint, list of subjects can be defined for subject field
Then insert values statement can be used to insert records. following Select statement will fetch desired result
Select * from tablename where registrationno = user...  more»
Create table using create table statement. Constraints used must be of primary key on student registration no. , Age limit can be set using range constraint, list of subjects can be defined for subject field
Then insert values statement can be used to insert records. following Select statement will fetch desired result
Select * from tablename where registrationno = user specified registration no. «less

0 0

Ekta replied | 25/07/2016

Create table using create table statement. Constraints used must be of primary key on student registration no. , Age limit can be set using range constraint, list of subjects can be defined for subject field
Then insert values statement can be used to insert records. following Select statement will fetch desired result
Select * from tablename where registrationno = user...  more»
Create table using create table statement. Constraints used must be of primary key on student registration no. , Age limit can be set using range constraint, list of subjects can be defined for subject field
Then insert values statement can be used to insert records. following Select statement will fetch desired result
Select * from tablename where registrationno = user specified registration no. «less

0 0

Answer

You can add upto 6 Images

U

Umang 05/05/2016 in  C Language Classes

What a beginner should do for learning coding

0 0

Satya replied | 06/06/2016

Choose a language and start practicing. That is the best way to learn any programming language. Internet is full of the materials.

0 0

Sarfraaz replied | 08/09/2016

To learn coding, there are two activities that you should spend most of your time in. One is to write code, and the other is to read code. Understand that coding is just a tool. The main intention of writing code, is to solve problems. So, look out for problems and find solutions for them. This will help you become a better coder.

0 0

Answer

You can add upto 6 Images

S

Show previous answers

Sarfraaz replied | 11/09/2016

C programming language is used to write code that will get converted to machine code [ processor instructions ]. The C compiler takes care of converting the C source code to processor specific machine code. C Compilers are specific to a Operating System and the corresponding processor architecture. With the vast variety of C compilers, it is now almost common to find a C compiler...  more»
C programming language is used to write code that will get converted to machine code [ processor instructions ]. The C compiler takes care of converting the C source code to processor specific machine code. C Compilers are specific to a Operating System and the corresponding processor architecture. With the vast variety of C compilers, it is now almost common to find a C compiler for almost any combination of Operating system and processor architecture. This helps us to write C code once, but get it easily compiled on any Operating system. Only in this sense, is C considered a machine independent Programming language. Since, the C syntax is completely independent of the processors instructions.

C is considered a portable language, but in practice is not easily portable. If you write a C program on Windows platform that accepts 2 numbers and gives the sum of these 2 numbers, it can very easily be compiled on a UNIX machine without any changes to the code. This code is now called "Portable code", since it can be easily ported from one Operating system to another. This may not be true, if the C code that we wrote on a Windows machine uses libraries or functions that are specific to Windows only. Ex : C code that includes dos.h header file that is not available on UNIX. To get this code compiled on a UNIX machine, this C program should now be made to handle a scenario where dos.h may not be available on the system at compile time. So, this becomes a tough task, though not impossible. Here we see that C is not very portable like any other high level language like Java or Python, which have very simple ways of tackling such scenarios. «less

0 0

Vihanga replied | 16/09/2016

IS C machine independent Programming Language? Answer is yes and No. Where C is using processor/Controller specific addresses only this portion is machine dependent. All other code is Machine independent.

Is C portable? Yes to an extent but not completely. Where controller specific code is used, this code is not portable. Other portion is possible when porting...  more»
IS C machine independent Programming Language? Answer is yes and No. Where C is using processor/Controller specific addresses only this portion is machine dependent. All other code is Machine independent.

Is C portable? Yes to an extent but not completely. Where controller specific code is used, this code is not portable. Other portion is possible when porting on to equivalent target. When some one is developing a large application, if you manage to port 50% from the existing software, imagine the time and cost one is saving. This is the advantage. «less

0 0

Answer

You can add upto 6 Images

U

Uday 01/05/2016 in  C Language Classes

Show previous answers

Ekta replied | 25/07/2016

C is a general purpose high level language suitable for business as well as scientific applications. It provides high level as well as low level constructs. Hence it is suitable for both application as well as system programming.

0 0

Chetan replied | 05/08/2016

C is a high-level and general purpose programming language that is ideal for developing firmware or portable applications. Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System (OS) in the early 1970s.
C is a structured, procedural programming language that has been widely used both for operating systems...  more»
C is a high-level and general purpose programming language that is ideal for developing firmware or portable applications. Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System (OS) in the early 1970s.
C is a structured, procedural programming language that has been widely used both for operating systems and applications and that has had a wide following in the academic community. Many versions of UNIX-based operating systems are written in C. C has been standardized as part of the Portable Operating System Interface «less

0 0

Answer

You can add upto 6 Images

K

Khushboo 01/05/2016 in  C Language Classes

Show previous answers

Umesh replied | 18/05/2016

1. Only variables of different data types can be declared, functions are not allowed
2. Direct access to data members is possible
3. ‘struct’ data type is not treated as built in type – use of ‘struct’ necessary to declare objects
4. Member variables cannot be initialized inside a structure

0 0

Kayam Gunasekhar Reddy K replied | 08/07/2016

C Structure: While construction -> hard to differentiate properties and functionalities of things (like brick, sand and water etc)
C++ structure: While construction -> easily can differentiate things from others (because each have their own properties and functionalities those are wrapped with wrapper called class)

0 0

Answer

You can add upto 6 Images

P

Priyanka 01/05/2016 in  C Language Classes

When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?

0 0 3

Show previous answers

Raghavendra replied | 01/05/2016

Imagine you have some set of inter related classes like mango , apple ,banana all these classes are having same functionality so instead of creating again repeated methods in these classes i will create a more generalized method fruits and in that i define the idea means how to do it and later on sub classes will implement those ideas so in a company many people will work for 2...  more»
Imagine you have some set of inter related classes like mango , apple ,banana all these classes are having same functionality so instead of creating again repeated methods in these classes i will create a more generalized method fruits and in that i define the idea means how to do it and later on sub classes will implement those ideas so in a company many people will work for 2 or 3 years and leave the company we cant take the code of them what they have written i mean to say in projects many people mainly project managers create abstract classes and later on sub ordinates will use or override the function of that idea which is present in abstract class like that it works.when project are very big we just modify the code in abstract class it will automatically modified in sub class it is like kind of relationship eg : mango is kind of fruit like that and once i declare a class abstract i have to override it if i declare it virtual then it is upto me to override or not .Now coming to interface when classes are not related like cycle , train , bus means bus is belonging to automobile class and cycle to some other class but these different classes want to implement common functionality then interface is used and it is used to overcome the draw back of multiple inheritance as i can implement multiple interfaces and there is another drawback in inheritance using base class object i cannot call the sub class function to overcome that abstract classes are used .Try this stuff using code you will understand better thank you «less

0 0

Rajesh replied | 03/05/2016

When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.

0 0

Answer

You can add upto 6 Images

D

Deepak 01/05/2016 in  C Language Classes

What is an abstract class?

0 0 3

Show previous answers

Rajib replied | 01/05/2016

The class whose object is not required to be created and which is defined to be inherited by another class is termed as abstract . to create an abstract class use the specifier abstract.
For example .
Abstract class AB
{
....
...,}

0 0

Rajesh replied | 03/05/2016

An abstract class is a class that is declared abstract —it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.

0 0

Answer

You can add upto 6 Images

P

Priya 30/04/2016 in  C Language Classes

Show previous answers

Ranjan replied | 16/05/2016

#include" " is used for header files in current directory, The compiler while resolving symbols searches the current directory for the header file. the other case of is used for standard directory searches of header files i.e as usually directed by makefiles.

0 0

Ranganath replied | 28/06/2016

the location where the header files reside.

First #include
- indicates that the headers are in the std C libraries installation folder.

------------------
#include" "

generally indicates the header files that the developed created, generally reside in the local folder.

0 0

Answer

You can add upto 6 Images

V

Vg.manikandan 30/04/2016 in  C Language Classes

Write a program for result management system of a college?

1 0

Rajesh replied | 05/05/2016

Pragram's cannot be written here.. request you to post it in another forum.. answers should not includes any symbols.. so

0 0

Brahmanand replied | 07/05/2016

This program have not small code to manage a result data of college's student .This problem solve with C basic code and file handling concept and take time approx 2-3 hours.

0 0

Answer

You can add upto 6 Images

D

Divya 30/04/2016 in  C Language Classes

What are the different storage classes in C?

0 0 3

Show previous answers

Akash Kumar replied | 28/05/2016

There are 4 storage class :
1) auto
2) register
3) static
4) extern

0 0

Ganesa replied | 31/05/2016

auto, static, register and extern are the four storage classes in c

0 0

Answer

You can add upto 6 Images

S

Saravana 30/04/2016 in  C Language Classes

How do you print an address?

0 0 3

Show previous answers

A

Arun replied | 01/05/2016

Using AddressOf Operator '&';

0 0

Adi replied | 03/05/2016

use %u for print address of any variable in c language

0 0

Answer

You can add upto 6 Images

S

Shubham 30/04/2016 in  C Language Classes

What are C and C++ languages?

0 0 3

Show previous answers

Kanchan replied | 30/04/2016

C is structured language and C++ is object oriented language.

0 0

Raghavendra replied | 01/05/2016

c and c++ are system languages which are very much near to hardware and it can make an hardware to run and it is difficult to write a system program .you can see drivers etc code will be written in c and c++ only so when a bug comes in system programming system itself will show you an error but when you go higher programming languages like java C# you have tester for them here no...  more»
c and c++ are system languages which are very much near to hardware and it can make an hardware to run and it is difficult to write a system program .you can see drivers etc code will be written in c and c++ only so when a bug comes in system programming system itself will show you an error but when you go higher programming languages like java C# you have tester for them here no tester and c is procedural oriented language which acts as base for improving your programming skill and coding skill and c++ is partially object oriented as main function can be written outside where in C# every thing has to be encapsulated in class only .With C# and Java we call them application oriented languages as applications can be developed and c++ and c can be used in embedded systems for any product development as well Thank you «less

0 0

Answer

You can add upto 6 Images

A

Anish 29/04/2016 in  C Language Classes

Show previous answers

Pravuram replied | 16/07/2016

to start with just learn about basic structure of C program. and then go for some simple programs with printf and scanf. if these practice is over then you can go for looping. but i would suggest that first you practice with sequential and selectional programming

0 0

Ekta replied | 25/07/2016

Practice is the key for perfection. Learn basic syntax and do as much programing as you can. Find a good trainer for guidance.

0 0

Answer

You can add upto 6 Images

A

Altaf 29/04/2016 in  C Language Classes

Can Any other language completely replace c?

0 0 3

Show previous answers

Meganadha replied | 07/05/2016

Every programming language has its pros and cons. So no programming language can completely replace C. C is evergreen programming language. For starters who are new to programming., C is the best way to get started.

0 0

Ranjan replied | 16/05/2016

Yes, it can be replaced...there are companies working on R&D to find a similar language. C language as of now do not have hold or control to execute on multi-core processor environment. There is already a challenge to find out a language which works better on multi-threaded and multi-core environment. However the cost to replace C will be huge ..especially when most system softwares...  more»
Yes, it can be replaced...there are companies working on R&D to find a similar language. C language as of now do not have hold or control to execute on multi-core processor environment. There is already a challenge to find out a language which works better on multi-threaded and multi-core environment. However the cost to replace C will be huge ..especially when most system softwares are written using C. «less

0 0

Answer

You can add upto 6 Images

R

Ramkumar 29/04/2016 in  C Language Classes

Will finally block get executed if the exception had not occurred?

0 0 3

Show previous answers

Raju Masand replied | 25/05/2016

Hi. Finally block always executes no matter exception has been caught or not. finally block is used to close your all connections like any database, socket, file, any other resources.

0 0

Flair replied | 29/05/2016

Short answer is "Yes". It will get executed even exception doesn't occur.

0 0

Answer

You can add upto 6 Images

R

Reshma 29/04/2016 in  C Language Classes

What are the features of C?

0 0 3

Show previous answers

Vanka replied | 08/05/2016

As it is a Structured oriented all the implementation of data structures can be done at ease.
All the features can be said as
1.Simple
2.Rich in library Functions
3.Faster Execution
4.Support of Pointers,which would make us to directly interact with the memory addresses.
5.Recursion ability.

0 0

Ekta replied | 13/05/2016

Main Features of C Language Includes :
1. C compiler combines the capabilities of an assembly language with features of a high-level language.
2. Programs Written in C are efficient and fast. This is due to its variety of data type and powerful operators.
3. It Contains functions rich libraries and we can create our own Library as per requirements.
4. Now a days...  more»
Main Features of C Language Includes :
1. C compiler combines the capabilities of an assembly language with features of a high-level language.
2. Programs Written in C are efficient and fast. This is due to its variety of data type and powerful operators.
3. It Contains functions rich libraries and we can create our own Library as per requirements.
4. Now a days , C Language is widely used in Operating Systems and embedded system development. «less

0 0

Answer

You can add upto 6 Images

N

Naina 29/04/2016 in  C Language Classes

What will print out? main() { char *p1=?name?; char *p2; p2=(char*)malloc(20); memset (p2, 0, 20); while(*p2++ = *p1++); printf(?%sn?,p2); }

0 0 4

Show previous answers

Sanjay Singh Bisht replied | 19/05/2016

int main()

{
char *p1="name";
printf("%s
",p1);
char *p2;
p2=(char*)malloc(20); // memory allocate size 20 byte,initialize with garbage value that,s why you use memset to clear memory
memset (p2, 0, 20); //use memset to clear memory ...  more»
int main()

{
char *p1="name";
printf("%s
",p1);
char *p2;
p2=(char*)malloc(20); // memory allocate size 20 byte,initialize with garbage value that,s why you use memset to clear memory
memset (p2, 0, 20); //use memset to clear memory
while(*p2++=*p1++) //when pointer P2 point to NULL while loop is terminated
{

printf("%s
",p2); //NULL value print
}

}
ans is NULL «less

0 0

Krishn replied | 21/05/2016

Out put of this will be n because in while loop you are assigning the value p2 from p1 and incriminating the both pointers p1 and p2 due to this your pointers p1 and p2 will point to the null. So when you try to pointer p2 it will point to nothing and it will print only n.

0 0

Answer

You can add upto 6 Images

Previous12345678Next

Have a Question?

Thousands of expert tutors are available to answer your question

Looking for C Language Classes?

Find best C Language Classes in your locality on UrbanPro.

FIND NOW

Do you offer C Language Classes?

Create Free Profile Now »

Top Contributors

Umasankar

50 Answers

Vinod

46 Answers

Sg

44 Answers

Dishaapro

44 Answers

Harish

44 Answers

Maqubool

32 Answers

Algorithm Class

25 Answers

Chetan

25 Answers

Rahul P

22 Answers

Sponsored

About UrbanPro

UrbanPro.com helps you to connect with the best C Language Classes in India. Post Your Requirement today and get connected.

Find Best C Language Classes?

Find Now »