Swift Data Type - Swift Programming Language Swift offers the programmer a rich assortment of built-in as well as user-defined data types. The following types of basic data types are most frequently when declaring variables − Integers Integers are whole numbers with no fractional component, such as 42 and -23. Integers are either signed (positive, zero,...
Swift Constants, Variables, Type Annotations, Print, Comments and Semicolons - Swift Programming Language Constants and variables associate a name (such as maximumNumberOfLoginAttempts or welcomeMessage) with a value of a particular type (such as the number 10 or the string "Hello"). The value of a constant cannot be changed once it is set, whereas a variable can be set to a different...
Machine Learning Why machine learning prevalent today? - Machine Learning Tutorial Machine learning is a field that had grown out of the field of AI, or Artificial Intelligence. We want to build intelligent machine and it turns out that there are a few basic things that we could program a machine to do such as how to find the shortest path...
Machine Learning Introduction to Machine Learning - Machine Learning Tutorial Machine learning is one of the most exciting recent technologies. So, What is Machine Learning? Machine learning is a subfield of computer science that evolved from the study of pattern recognition and computational learning theory in artificial intelligence. In 1959, Arthur Samuel defined machine learning as a "Field of...
Primary Difference between C and Ansi C Main difference: C was originally developed by Dennis Ritchie at AT&T Bell Labs between 1969 and 1973. It has a free-format program source code. C is a general-purpose programming language. C is one of the oldest currently used programming languages and is one of the most...
News Your iOS App Has To Be IPv6 Ready before 1st June. At WWDC 2015 Apple announced the transition to IPv6-only network services in iOS 9. Starting June 1, 2016 all apps submitted to the App Store must support IPv6-only networking. Most apps will not require any changes because IPv6 is already supported by NSURLSession and CFNetwork APIs. If your...
Primary What does the C ??!??! operator do? ??! is a trigraph that translates to |. So it says: if(a || b){ ... }else{ ... } So, what is digraphs and trigraphs? In computer programming, digraphs and trigraphs are sequences of two and three characters, respectively, that appear in source code and, according to a programming language specification, should be treated as if...
Primary Why in C language is it the case that a[5] == 5[a]? The C standard defines the Array Subscript Operator [] as follows: a[b] == *(a + b) Therefore a[5] will evaluate to: *(a + 5) and 5[a] will evaluate to: *(5 + a) and from elementary math we know those are equal. This is the direct artifact of arrays behaving as pointers, "...
Primary Why isn't sizeof for a struct equal to the sum of sizeof of each member? This is because of padding added to satisfy alignment constraints. Data structure alignment impacts both performance and correctness of programs. Here's an example using typical settings for an x86 processor (all used 32 and 64 bit modes): struct X { short s; /* 2 bytes */ /* 2 padding bytes */ int i;...
Primary Why is one loop so much slower than two loops? Suppose a1, b1, c1, and d1 point to heap memory and code has the following loop. const int n=100000; for(int j=0;j<n;j++){ a1[j] += b1[j]; c1[j] += d1[j]; } This loop is executed 10,000 times via another outer for loop. To speed...
Primary Why is processing a sorted array faster than an unsorted array? Here is a piece of Visual C++ code that seems very peculiar. For some strange reason, sorting the data miraculously makes the code almost six times faster. #include <algorithm> #include <ctime> #include <iostream> int main() { // Generate data const unsigned arraySize = 32768; int data[arraySize]...
Primary What is the difference between #include <filename> and #include “filename”? The difference is in the location where the preprocessor searches for the included file. For #include "filename" the preprocessor searches in the same directory as the file containing the directive. This method is normally used to include programmer-defined header files. For #include <filename> the preprocessor...
Primary What are the differences between a pointer variable and a reference variable? * A pointer can be re-assigned: int x = 5; int y = 6; int *p; p = &x; p = &y; *p = 10; assert(x == 5); assert(y == 10); A reference cannot, and must be assigned at initialization: int x = 5; int y = 6; int &r = x; * A pointer has...
Primary What is the name of the "-->" operator? Here's an example: #include <stdio.h> int main() { int x = 10; while( x --> 0 ) // x goes to 0 { printf("%d ", x); } } Answer --> is not an operator. It is in fact two separate operators, -- and >. The conditional's code decrements x,...
News Windows 10 Free Upgrade Offer to End Soon The free upgrade offer to Windows 10 was a first for Microsoft, helping people upgrade faster than ever before. And time is running out. The free upgrade offer will end on July 29 and we want to make sure you don’t miss out. After July 29th, you’ll be...