Search Results

Search found 176 results on 8 pages for 'mohit bhandari'.

Page 6/8 | < Previous Page | 2 3 4 5 6 7 8  | Next Page >

  • Compile multiple C files with make

    - by Mohit Deshpande
    (I am running Linux Ubuntu 9.10, so the extension for an executable is executablefile.out) I am just getting into modular programming (programming with multiple files) in C and I want to know how to compile multiple files in a single makefile. For example, what would be the makefile to compile these files: main.c, dbAdapter.c, dbAdapter.h? (By the way, If you haven't figured it out yet, the main function is in main.c) Also could someone post a link to the documentation of a makefile?

    Read the article

  • Pointers and Addresses in C

    - by Mohit
    #include "stdio.h" main() { int i=3,*x; float j=1.5,*y; char k='c',*z; x=&i; y=&j; z=&k; printf("\nAddress of x= %u",x); printf("\nAddress of y= %u",y); printf("\nAddress of z= %u",z); x++; y++;y++;y++;y++; z++; printf("\nNew Address of x= %u",x); printf("\nNew Address of y= %u",y); printf("\nNew Address of z= %u",z); printf("\nNew Value of i= %d",i); printf("\nNew Value of j= %f",j); printf("\nNew Value of k= %c\n",k); } Output: Address of x= 3219901868 Address of y= 3219901860 Address of z= 3219901875 New Address of x= 3219901872 New Address of y= 3219901876 New Address of z= 3219901876 New Value of i= 3 New Value of j= 1.500000 New Value of k= c The new address of variable y and z are same. How can two variables have same address and et have different values? Note: I used gcc compiler on Ubuntu 9.04

    Read the article

  • #Define's scope throughout library?

    - by Mohit Deshpande
    Say I have a constant: #define PI 3.14 Say I have a static library with multiple header and source files. If I declare this in the header file, will its scope apply to all of the source files? Or do the source files need to include the header with the declaration of PI?

    Read the article

  • ios::nocreate error while compiling a C++ code

    - by Mohit Nanda
    While, compiling a package, written in C++ on RHEL 5.0. I am getting the following error. error: nocreate is not a member of std::ios The source-code corresponds to: ifstream tempStr(argv[4],ios::in|ios::nocreate); I have tried #g++ -O -Wno-deprecated <file.cpp> -o <file> as well as: #g++ -O -o <file> Please suggest a solution.

    Read the article

  • How to build Linux system from kernel to UI layer

    - by mohit
    Hi, I have been looking into MeeGo, maemo, Android architecture. They all have Linux Kernel, build some libraries on it, then build middle layer libraries [e.g telephony, media etc...]. Suppose i wana build my own system, say Linux Kernel, with some binariers like glibc, Dbus,.... UI toolkit like GTK+ and its binaries. I want to compile every project from source to customize my own linux system for desktop, netbook and handheld devices. [starting from netbook first :)] How can i build my own customize system from kernel to UI.

    Read the article

  • C# Unit testing resources

    - by Mohit Deshpande
    I migrated from Java to C# and so I am wondering how to unit tests in C#. I remember using JUnit to test my Java applications and importing the package, etc. How can I unit test in C#? What are some good resources for unit testing in C#?

    Read the article

  • Why one loop is performing better than other memory wise as well as performance wise?

    - by Mohit
    I have following two loops in C#, and I am running these loops for a collection with 10,000 records being downloaded with paging using "yield return" First foreach(var k in collection) { repo.Save(k); } Second var collectionEnum = collection.GetEnumerator(); while (collectionEnum.MoveNext()) { var k = collectionEnum.Current; repo.Save(k); k = null; } Seems like that the second loop consumes less memory and it faster than the first loop. Memory I understand may be because of k being set to null(Even though I am not sure). But how come it is faster than for each. Following is the actual code [Test] public void BechmarkForEach_Test() { bool isFirstTimeSync = true; Func<Contact, bool> afterProcessing = contactItem => { return true; }; var contactService = CreateSerivce("/administrator/components/com_civicrm"); var contactRepo = new ContactRepository(new Mock<ILogger>().Object); contactRepo.Drop(); contactRepo = new ContactRepository(new Mock<ILogger>().Object); Profile("For Each Profiling",1,()=>{ var localenumertaor=contactService.Download(); foreach (var item in localenumertaor) { if (isFirstTimeSync) item.StateFlag = 1; item.ClientTimeStamp = DateTime.UtcNow; if (item.StateFlag == 1) contactRepo.Insert(item); else contactRepo.Update(item); afterProcessing(item); } contactRepo.DeleteAll(); }); } [Test] public void BechmarkWhile_Test() { bool isFirstTimeSync = true; Func<Contact, bool> afterProcessing = contactItem => { return true; }; var contactService = CreateSerivce("/administrator/components/com_civicrm"); var contactRepo = new ContactRepository(new Mock<ILogger>().Object); contactRepo.Drop(); contactRepo = new ContactRepository(new Mock<ILogger>().Object); var itemsCollection = contactService.Download().GetEnumerator(); Profile("While Profiling", 1, () => { while (itemsCollection.MoveNext()) { var item = itemsCollection.Current; //if First time sync then ignore and overwrite the stateflag if (isFirstTimeSync) item.StateFlag = 1; item.ClientTimeStamp = DateTime.UtcNow; if (item.StateFlag == 1) contactRepo.Insert(item); else contactRepo.Update(item); afterProcessing(item); item = null; } contactRepo.DeleteAll(); }); } static void Profile(string description, int iterations, Action func) { // clean up GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); // warm up func(); var watch = Stopwatch.StartNew(); for (int i = 0; i < iterations; i++) { func(); } watch.Stop(); Console.Write(description); Console.WriteLine(" Time Elapsed {0} ms", watch.ElapsedMilliseconds); } I m using the micro bench marking, from a stackoverflow question itself benchmarking-small-code The time taken is For Each Profiling Time Elapsed 5249 ms While Profiling Time Elapsed 116 ms

    Read the article

  • How would someone implement mathematical formulae in java?

    - by Mohit Deshpande
    What I mean is like have to user input a string with multiple variables and get the value of those variable. Like a simple quadratic formula: x^2 + 5x + 10. Or in java: (Math.pow(x,2)) + (x * 5) + 10The user would then enter that and then the program would solve for x. I will be using the BeanShell Interpreter class to interpret the string as an equation. But how would I solve for x?

    Read the article

  • Malloc function in C++

    - by Mohit Deshpande
    I am transitioning to C++ from C. In C++, is there any use for the malloc function? Or can I just declare it with the "new" keyword. For example: class Node { ... } ... Node *node1 = malloc(sizeof(Node)); //malloc Node *node2 = new Node; //new Which one should I use?

    Read the article

  • Development life-cycle for making an application?

    - by Mohit Deshpande
    I have an idea that I want to make into an application (I have a C/C++, C#, and Java programming background so I will be developing in QT Creator for cross-compilation's sake). So now I am asking you senior developers, what should I do next? I know that all good programs come from an idea. Then what should I do? Prototype the UI? Then develop the code? Is there like a circle of the development of an application? I DO NOT MEAN FOR THIS QUESTION TO BE SUBJECTIVE OR ARGUMENTATIVE

    Read the article

  • Timer to find elapsed time in a function call in C

    - by Mohit Nanda
    I want to calculate time elapsed during a function call in C, to the precision of 1 nanosecond. Is there a timer function available in C to do it? If yes please provide a sample code-snippet. Pseudo code Timer.Start() foo(); Timer.Stop() Display time elapsed in execution of foo() Environment details: - using gcc 3.4 compiler on a RHEL machine

    Read the article

< Previous Page | 2 3 4 5 6 7 8  | Next Page >