Sponsored Content
Full Discussion: diff b/w char const in C/C++
Top Forums Programming diff b/w char const in C/C++ Post 85709 by jim mcnamara on Thursday 6th of October 2005 04:57:53 PM
Old 10-06-2005
It's an interview question that misguided IT managers use to impress/confuse prospective applicants. IMO anyway.

The answer is explained here:

http://www.eskimo.com/~scs/C-faq/q8.9.html
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies

2. Programming

Reference to a const

Can any one explain how the statement '2' in the following statements is a legal one. int & ref = 3; // Illegal statement - Compiler error. const int& ref=3 ; // Compile and executes properly. Thanks in Advance, Arun (1 Reply)
Discussion started by: arun.viswanath
1 Replies

3. UNIX for Dummies Questions & Answers

int open(const char *pathname, int flags, mode_t mode) doubt...

hello everybody! I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fileDescriptor; fileDescriptor =... (2 Replies)
Discussion started by: csnmgeek
2 Replies

4. Programming

concat const char * with char *

hello everybody! i have aproblem! i dont know how to concatenate const char* with char const char *buffer; char *b; sprintf(b,"result.txt"); strcat(buffer,b); thanx in advance (4 Replies)
Discussion started by: nicos
4 Replies

5. Programming

Questions about const

Hi all, I have some questions about functions. In a code I have (a .hpp file) there is this line which says: const Class_1_Name* Class_2_Name::MethodName(int ipart) const {return (ClassName*)_ref_to_method.At(ipart);} My questions are: What is the meaning of the two constants,... (2 Replies)
Discussion started by: eager2no
2 Replies

6. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

7. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

8. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

9. Programming

Using const char*

I am writing some code in C++ to print a message using fprintf Here is an example void pr_desc( FILE* stream, int shift, const char* desc) { const char* format="%*s\e; fprintf(stream,format,shift,"",desc); } I call it using const char* desc; ... (4 Replies)
Discussion started by: kristinu
4 Replies

10. Programming

Double to const char conversion

Dear all, I am using C and ROOT for programming. And I need to incorporate following in my code. char *fps=NULL; int dec=0,sign=0; float mean = h1->GetMean(1); //0.001298 fps= fcvt(mean,6 , &dec, &sign); I need to provide this mean as const char to some other function to get... (8 Replies)
Discussion started by: emily
8 Replies
DATETIMEIMMUTABLE.DIFF(3)						 1						 DATETIMEIMMUTABLE.DIFF(3)

DateTime::diff - Returns the difference between two DateTime objects

       Object oriented style

SYNOPSIS
public DateInterval DateTime::diff (DateTimeInterface $datetime2, [bool $absolute = false]) DESCRIPTION
DateInterval DateTimeImmutable::diff (DateTimeInterface $datetime2, [bool $absolute = false]) DateInterval DateTimeInterface::diff (Date- TimeInterface $datetime2, [bool $absolute = false]) Procedural style DateInterval date_diff (DateTimeInterface $datetime1, DateTimeInterface $datetime2, [bool $absolute = false]) Returns the difference between two DateTimeInterface objects. PARAMETERS
o $datetime - The date to compare to. o $absolute - Should the interval be forced to be positive? RETURN VALUES
The DateInterval object representing the difference between the two dates or FALSE on failure. EXAMPLES
Example #1 DateTimeImmutable.diff(3) example Object oriented style <?php $datetime1 = new DateTime('2009-10-11'); $datetime2 = new DateTime('2009-10-13'); $interval = $datetime1->diff($datetime2); echo $interval->format('%R%a days'); ?> Procedural style <?php $datetime1 = date_create('2009-10-11'); $datetime2 = date_create('2009-10-13'); $interval = date_diff($datetime1, $datetime2); echo $interval->format('%R%a days'); ?> The above examples will output: +2 days Example #2 DateTime object comparison Note As of PHP 5.2.2, DateTime objects can be compared using comparison operators. <?php $date1 = new DateTime("now"); $date2 = new DateTime("tomorrow"); var_dump($date1 == $date2); var_dump($date1 < $date2); var_dump($date1 > $date2); ?> The above example will output: bool(false) bool(true) bool(false) SEE ALSO
DateInterval.format(3), DateTime.add(3), DateTime.sub(3). PHP Documentation Group DATETIMEIMMUTABLE.DIFF(3)
All times are GMT -4. The time now is 12:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy