language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "powermon.h"
void Initialize(int fd);
void Run(int fd) {
//int16_t x, y, z;
float current = 0, voltage = 0;
printf("Pmon Demo Launched\n");
for (int i=0; i<10; i++){
current = 0; voltage = 0;
Initialize(fd);
Pmon_VoltageCurrentRead(fd, &voltage, ¤t);
printf("Voltage= %.3fV Current= %... |
C | #include "cacti.h"
#include "err.h"
#include <pthread.h>
#include <semaphore.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#define CASTSIZE 1024
typedef struct actor {
const actor_id_t id;
actor... |
C | #include <stdio.h>
#include <sys/prctl.h>
#include <sys/capability.h>
#include <sys/types.h>
int main (void)
{
cap_t cap = cap_get_proc();
printf("Running with uid %d\n", getuid());
printf("Running with capabilities: %s\n", cap_to_text(cap, NULL));
cap_free(cap);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int num = 0;
char* input;
input = (char*)malloc(sizeof(char)*100);
scanf("%s", input);
int length = strlen(input);
for(int i = 0; i < length; i++) {
if(i != 0 && i%10 == 0) printf("%s", "\n");
printf("%c", input[i]);
}
return 0;
} |
C | /* Author: lab
* Partner(s) Name:
* Lab Section:
* Assignment: Lab # Exercise #
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <avr/io.h>
#ifdef _SIMULATE_
#include "s... |
C | #include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include "../my_list.h"
#include "../my.h"
int launch_cd(char **commands, t_envlist **env_cp)
{
char **saved_path;
t_envlist *start;
start = *env_cp;
saved_path = xmalloc(sizeof(*saved_path) * 2);
while((... |
C | #include <stdio.h>
int main() {
int a = 4, b = 8, c = 1, d = 1 ;
printf( "Addition: %d \n", a + b ) ;
printf( "Subtraction: %d \n", b - a ) ;
printf( "Multiplication: %d \n", a * b ) ;
printf( "Division: %d \n", b / a ) ;
printf( "Modulud: %d \n", a % b ) ;
printf( "Postfix increment: %d \n", c++ ) ;
printf... |
C | //
// przedmioty.h
// BazaStudentow
//
// Created by Maciej Dmowski on 19/11/2018.
// Copyright © 2018 Maciej Dmowski. All rights reserved.
//
#ifndef studenci_h
#define studenci_h
#include <stdlib.h>
#include <string.h>
#include "czyscBufor.h"
#include "wczytajDodatniInt.h"
#include "wykladowcy.h"
#include "prze... |
C | /* DIGITAL SIGNATURE(S):
====================
List the student author(s) of this code below:
Fullname Seneca Email Address
--------------------------- ----------------------------
1)Harkirat Singh Virdi hsvirdi7@myseneca.ca
2)Tahsin Rahman trahman31@myseneca.ca
... |
C | /* **********
exercise 12b Lesson 8 - Programming in C
Transpose Matrix Function
variable length arrays
***** */
#include <stdio.h>
int main (void)
{
void transposeMatrix (int nRows, int nCols, char matrixA[nRows][nCols], char matrixB[nCols][nRows]);
void displayMatrix (int nRows, int nCols, char matri... |
C | ////////////////////////////////////////////////////////////
// testccpuid.cpp : ccpuid.h, ʾеCPUIDϢ.
// Author: zyl910
// Blog: http://www.cnblogs.com/zyl910
// URL: http://www.cnblogs.com/zyl910/archive/2012/07/11/ccpuid.html
// Version: V1.0
// Updata: 2012-07-11
//////////////////////////////////////////////////////... |
C | /*
Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.
Example 1:
Input: [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Example 2:
Input: [-7,-3,2,3,11]
Output: [4,9,9,49,121]
Note:
1 <= A.length <= 10000
-10000 <= A[i] <= 1000... |
C | #include <stdio.h>
int arraysum(int n, int a[]){
int sum = 0;
int i = 0;
for(i=0;i<n;i++){
sum += a[i];
}
return sum;
}
int main() {
int n, i, sum, avg;
int count = 0;
int score[100] = {0};
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &score[i]);
}
sum = arraysum(n, score);
avg = sum / n;
... |
C | #include "holberton.h"
#include <stdio.h>
/**
* main - check the code for Holberton School students.
*
* Return: Always 0.
*/
int main(void)
{
char s[] = "holberton!";
char a[] = "a";
char b[] = "Vagrant pro1234567890123456789vides a command-line tool for loading and managing virtual operating systems. We will ... |
C | #include <stdio.h>
int max(int a, int b)
{
if(a>b)
return a;
else
return b;
}
int knapsack(int matr[][6],int weight[], int value[], int capa,int num)
{
if(capa <= 0)
return 0;
if(matr[num][capa] != 0)
return matr[num][capa];
matr[num][capa] = max(value[num]+knapsack(matr,weight,valu... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int count;
count=1;
while(count<=10)
{
if(count%2!=0)
{
printf("%d",count);
}
count++;
}
getch();
}
|
C | #include <stdio.h>
int main()
{
int x,*px,**pz;
x=1;
px=&x;
int ***pt;
pz = &px;
pt = &pz;
printf("***pt=%d\n",***pt);
printf("x= %d\n",x);
printf("&x= %u\n",&x);
printf("px= %u\n",px);
printf("*px+1= %d\n",*px+1);
printf("px= %u\n",px);
printf("*px= %d\n",*px);
printf("*px+=1= %d\n",*px+=1... |
C | #include<stdio.h>
int main(int argc, char *argv[]){
unsigned int val = 3125442;
long valLong = 12456321778963114;
signed int signedInt = -12544;
printf("Unsigned: %d\n",val);
printf("Long:%ld\n", valLong);
printf("Signed:%d\n", signedInt);
return 0;
}
|
C | #include "holberton.h"
/**
* _memcpy - This is my function copy the number the character to S
* @dest: This is my entry and return
* @src: This is the character to copy
* @n: This is the number of Bytes
*
* Return: This is my result and Return dest
*/
char *_memcpy(char *dest, char *src, unsigned int n)
{
unsi... |
C | #include "binary_trees.h"
/**
* binary_tree_insert_left - inserts a node as the left-child of another node
* @parent: pointer to the node to insert the left-child in
* @value: value to store in the new node
*
* Return: pointer to the created node
*/
binary_tree_t *binary_tree_insert_left(binary_tree_t *parent, in... |
C | /*
* strings.c
* bouncingbots
*
* Created by David Reed on 5/2/12.
* Copyright 2012 David Reed. All rights reserved.
*
*/
#include "strings.h"
#include "board.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
char *read_token(const char *str, bb_cell *out_... |
C | /* mehPL:
* This is Open Source, but NOT GPL. I call it mehPL.
* I'm not too fond of long licenses at the top of the file.
* Please see the bottom.
* Enjoy!
*/
#include <stdio.h>
//#include "../0.97/cirBuff.h"
#include _CIRBUFF_HEADER_
//I dunno about threading nor OSX interrupts, so I can't test bl... |
C | #include <stdio.h>
int main(void)
{
int a = 10;
int b = 12;
printf("a & b : %d\n", a & b);
printf("a ^ b : %d\n", a ^ b);
printf("a | b : %d\n", a | b);
printf("~a : %d\n", ~a);
printf("a << 1 : %d\n", a << 1);
printf("a >> 2 : %d\n", a >> 2);
char ch = 128; // 0b 1000 0000
printf("ch >> 1 : %d", ... |
C | #ifndef MELON_GFX_COMMANDS_H
#define MELON_GFX_COMMANDS_H
#include <melon/gfx.h>
////////////////////////////////////////////////////////////////////////////////
// COMMAND BUFFER
// - NOT completely thread safe. Recording is intended to be done on one thread
// at a time
// - Recording is blocked by consuming and ... |
C | #include <stdio.h>
#include <stddef.h>
// Alignment requirements
// (typical 32 bit machine)
//
// char 1 byte
// short int 2 bytes
// int 4 bytes
// double 8 bytes
//
// structure A
typedef struct structa_tag
{
char c;
short int s;
} structa_t;
// structure B
typedef struct structb_tag
{
short int... |
C | #include<stdio.h>
#include <stdlib.h>
#define SIZE 100;
int main(int argc,char *argv[]){
int dim = atoi(argv[1]);//"3", argv[0]
int a[100][100];
int circle_num = dim;
int index_x;
int left_up, right_down;
int i, j;
int number = 0;
for(index_x = 0; index_x < circle_num; index_x += 2)
... |
C | /* ƽ ҽ ڵ */
/* char ? */
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <windows.h>
#include <math.h>
int whofirst = 0; /* İ */
int winner = 0; /* ڴ... */
int tictactoe_game();/* Լ */
int tictactoe_end(int*, int, int, int);/* Լ */
int tictactoe_whowin(int*);/* Լ */
i... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* l3d_triangle_clipping.c :+: :+: :+: ... |
C | #include <stdio.h>
//NUMBER EXERCISES
int main() {
double a, b, c;
printf("First, the cuboid! Insert 3 numbers: \n");
scanf("%lf", &a);
scanf("%lf", &b);
scanf("%lf", &c);
double surface = a*b*6;
double volume = a*b*c;
printf("Surface: %lf\n", surface);
printf("Volume: %lf\n", volum... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
/*
Illustrate execvp
*/
int main()
{
int i = 5;
char *prog_argv[2];
int status;
prog_argv[0] = "/home/user/Lectures/Exec/B";
prog_argv[1] = NULL;
printf("%d\n",i);
status = exec... |
C | #include "pthread.h"
#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "semaphore.h"
int n, g;
sem_t s;
void* f(void* a){
int el;
sem_wait( &s );
g++;
printf( "G:%d\n", g );
g--;
sem_post( &s );
}
int main(){
srand(getpid());
printf("Give n: ");
scanf("%d", &n);
sem_init( &s, 0, 2 );
// ... |
C | // Largest palindrome product
// website: https://projecteuler.net/problem=4
// A palindromic number reads the same both ways.
// The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
// Find the largest palindrome made from the product of two 3-digit numbers which is less than N.
// N ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node{
int count;
double frequency;
char* word;
struct node* leftChild;
struct node* rightChild;
} node;
typedef struct BST{
int totalCount;
struct node* root;
} BST;
node* newBSTNode(char* word){
node* newNode;
... |
C | #include<stdio.h>
int main()
{
int a[10]={0,1,2,3,4,5,6,7,8,9};
int i;
for(i=0;i<10;i++){
if(i%2==1)
continue;
else
a[i]=a[i]++;
}
for(i=0;i<10;i++){
printf("%d\n",a[i]);
}
return 0;
}
|
C | #include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
int fd;
unsigned char InBuffer[10000];
unsigned char OutBuffer[10000];
unsigned char CurKey;
unsigned char DupeChar;
int DataLen;
int OutDataLen;
int CurPos;
int EntryLen;
//get the file data
fd... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#define num_nodes 3
#define num_total_states (int)pow(2,num_nodes)
#define s_size 1
//#define s_size (num_nodes % 32 == 0)? (num_nodes >> 5) : (num_nodes >> 5) + 1
/* bit operations */
#define SetBit(A,k) (A[(k >> 5)] ... |
C | /*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPoint_DEFINED
#define SkPoint_DEFINED
#include "SkMath.h"
#include "SkScalar.h"
/** \struct SkIPoint16
SkIPoint holds two 16 bit integer c... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fork.c :+: :+: :+: ... |
C | //garden2 - ~Circe~ 1/13/08 for new Seneca
#include <std.h>
#include "../seneca.h"
inherit STORAGE"garden_inherit";
void create(){
::create();
set_long(::query_long()+"\n%^RESET%^%^GREEN%^This section "+
"of the %^BOLD%^gardens %^RESET%^%^GREEN%^is bounded on "+
"the south and west by a %^BOLD%^%^BL... |
C | /*
* Criar uma funo que receba um vetor de caracteres (frase, vetor de char) e retorne a quantidade de palavras(int)?
*/
#include <stdio.h>
int contaPalavras(char frase[]) {
int numeroPalavras = 1, i = 0;
while(frase[i] != '\0') {
if(frase[i] == ' ') {
++numeroPalavras;
}
... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
int main()
{
char* file_to_create = "created_file";
creat(file_to_create, 0777);
printf("Opening an existing file in Read/Write more\n");
int ret = open(file_to_create, O_RDWR);
if(ret == -1)
printf("Unable to open the file!\n")... |
C |
#include "BSTree.h"
#include <stdlib.h>
BSTree BSTreeGetSmallest(BSTree t) {
// Empty Tree
if( t == NULL) return NULL;
// The smallest number is at the leftmost node of the tree
if (t->left == NULL) {
return t;
} else {
t = BSTreeGetSmallest(t->left);
}
return t;
}
|
C | /* Copyright (C) Kevin Costa Scaccia - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Kevin Scaccia <kevin_developer@outlook.com>, March 2019
*/
/************************
Shell functionalities
*******************
1. Single... |
C | #include <stdio.h>
///Exerccio 3: O programa 1 foi modificado levemente e virou 3. Complete os pedaos que faltam.
void Troca (int *a, int *b) {
int temp;
temp = *a;
*a = *b;
*b = temp;
} /* Fim de Troca */
int main (void) {
int x, y;
int *px, *py;
/* Nao se usa isto normalmente. I... |
C | /* list.h */
#ifndef LIST_H_
#define LIST_H_
#define MAX_USR_NAME 31
#define MAX_GR_NAME 31
#include "utils.h"
enum fieldtype { PID, RCHAR, WCHAR, SYSR, SYSW, RFS, WFS} ;
typedef struct Record{
char type;
mode_t mode;
int nlinks;
char user[MAX_USR_NAME];
char ... |
C | /*
* Calculate the mode mixing matrix for 2D power spectrum measurements
* Input: C_l power spectrum of a mask, e.g. output of anafast(mask)
* Output: Mll' which describes \tilde C_l = anafast(mask*map) = M_ll' C_l
* lmax, the dimension of Mll', is hard coded in main()
* The input power spectrum should start with ... |
C | /*
* program name:book1.c
* author:neko date:20201126
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "_public.h"
int get_str_from_XML(const char *xml, const char *filed_name, char *return_value);
int get_int_from_XML(const char *xml, const char *filed_name, int *return_value);
struct st_g... |
C | //memory allocation动态分配内存
#include<stdio.h>
#include<stdlib.h>//用于提供malloc原型
int main()
{
//使用动态内存分配要记住一点,你是借来的内存,要还
unsigned int n;
int *i=NULL;
i=(int*)malloc(n*sizeof(int));//动态分配n个int内存
i=(int*)calloc(n,sizeof(int));//动态分配n个int内存,并讲其中的元素值全变为0
realloc(i,n*sizeof(int));//将i里面容纳元素的范围增大到n个
f... |
C | /******************************************************************************
* File Name : loopctl.h
* Date First Issued : 08/17/2015
* Board : f103
* Description : Control loop for yogurt maker
*******************************************************************************/
/* Define t... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "..\source\c\dsprocessing.c"
/*
Main example for FFT and DFT, files or whatever as input (stdin)
whatch out for the maximum size
*/
#define nsMax 10000
void
Dft_Fft_Demo(){
unsigned int i=0, ns, ns_2; /* counter, input size, power 2 size... |
C | /*
* my_it_callbacks.c
*
* Created on: 10-03-2020
* Author: julio
* Basado en: https://www.youtube.com/watch?v=VdHt_wJdezM
*/
#include "my_it_callbacks.h"
uint8_t ok[4] = {'o','k','\r','\n'};
static uint8_t buffer[10];
uint8_t interrupciones = 0;
uint8_t indice = 0;
uint8_t data;
void HAL_UART_RxCpltCall... |
C | #include <stdio.h>
int main()
{
int k,kasus;
int angka,i,j,temp[1001],count;
long long unsigned faktor=1;
scanf("%d",&kasus);
for(k=1;k<=kasus;k++)
{
scanf("%d",&angka);
printf("Case #%d:\n",k);
for(i=0;i<1001;i++)
{
temp[i]=0;
}
for(j=1;j<=angka;j... |
C | #include <stdio.h>
/* myHead : displayArr : start */
void displayArr(int arr[], int len)
{
for(int i = 0 ; i < len ; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
}
/* myHead : displayArr : end */
/* myHead : insertion_sort : start */
void insertion_sort(int arr[], int ... |
C | static string skill;
static int skill_points;
static int skill_verb;
static string skill_wiz;
static string Teacher;
ABuildPoints(int num){
BuildPoint += num;
return;
}
RBuildPoints(int num){
BuildPoint -= num;
return;
}
ASkillPoints(int num){
SkillPoint += num;
return;
}
RSkillPoints(int num){
... |
C | //
// array.c
// ObjectVM
//
// Created by Kyle Roucis on 13-12-6.
// Copyright (c) 2013 Kyle Roucis. All rights reserved.
//
#include "array.h"
#include "object.h"
#include "class.h"
#include "vm.h"
#include "block.h"
#include "primitive_table.h"
#include "integer.h"
#include "clkwk_debug.h"
#include <stdlib.h... |
C | #include<stdio.h>
#include<math.h>
int main(void){
float r, k;
double x, x0, xx;
int t;
r=0.4; k=1000; x0=10;
FILE *fp;
fp=fopen("output.dat", "a");
fprintf(fp, "%d, %f\n", 0, x0);
x=x0;
for(t=0; t<300; t++){
xx=x+r*(1-x/k)*x;
fprintf(fp, "%d, %f\n", t, xx);
x=xx;
}
fclose(fp);
r... |
C | #include "../include/arrayInt.h"
void printArray(array_int * a){
if(a){
printf("INITIAL CAPACITY: %d\nCAPACITY: %d\nSIZE: %d\n",a->i_cap,a->capacity,a->size);
int i;
printf("DADOS DO ARRAY\n");
printf("----------------\n");
for(i = 0; i < a->size; i++){
printf("V... |
C | /*
* jis2sj.c -- JIS to SHIFT-JIS converter
* Copyright(c) Jiro Kamina 1997. All rights reserved.
* $Header: jis2sj.cv 1.1 98/09/22 12:04:08 Exp $
*/
unsigned short
jis2sj(unsigned short us)
{
unsigned short jh, jl;
jh = (us >> 8) & 0xff;
jl = (us & 0xff) + 0x1f;
if (!(jh & 0x01)) {
jl += 0x7f - 0x21;
}... |
C | #include <stdio.h>
int main()
{
int a , b , addition , substraction , multiplication;
float div ;
printf("ENTER TWO NUMBERS");
scanf("%d %d",&a ,&b);
addition = a+b;
substraction = a-b;
multiplication = a*b;
div=a/b;
printf("\nsum = %d",addition);
printf("\ndiffrence = %d", substraction);
printf... |
C | ////
//// Created by shuncs on 19-2-28.
////
//
//#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//
//int main(void)
//{
// //strlen用来获取字符串长度
// //strlen返回的是无符号的整形
// //返回的长度不包括'\0'
// char *p = "zhushuai";
// size_t len = strlen(p);
// printf("%lu\n", len);
//
// //int strcmp(cons... |
C | #version 420
// use glEnableVertexAttribArray(0) and glVertexAttribPointer(0, ...) to define this input data
layout(location = 0) in vec4 in_position;
// we don't need a color input anymore, as the color is derived from the in_position.w component
out vec4 color;
// We use a uniform buffer object to store things tha... |
C | #include "unp.h"
#include "myerror.h"
/**
* write n bytes to file fd
* if fail return -1, otherwise always return n
*/
int writen(int fd, char* buf, int n){
int left = n;
int written = 0;
char* ptr = buf;
while(left > 0){
if((written = write(fd, ptr, left)) != left){
if(written =... |
C | /*
* LibLista.h: Libreria de utilidades basicas para uso de listas
*/
struct NodoListaSimple {
char * val;
struct NodoListaSimple * sig;
};
struct NodoListaConCant {
char * val;
int apariciones;
struct NodoListaConCant * sig;
};
struct NodoListaInts {
int val;
struct NodoListaInts * sig;
};
struct NodoLis... |
C | #ifndef __BITSET_H__
#define __BITSET_H__
#ifndef _UV
#define _UV(x) (1 << (x))
#endif
#ifndef _SETBIT
#define _SETBIT(x, y) ((x) |= _UV(y))
#endif
#ifndef _CLRBIT
#define _CLRBIT(x, y) ((x) &= ~_UV(y))
#endif
#ifndef _GETBITS
#define _GETBITS(c, start, len) (((c >> start << (8-len)) & 0xFF) >> (8-len))
#endif
#if... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node* NodePointer;
typedef struct node {
int vertex;
int weight;
NodePointer next;
} Node;
typedef struct graph* GraphPointer;
typedef struct graph {
int numV;
NodePointer* adjLists;
} Graph;
NodePointer createNode(int v, int w) {
NodePointer newNode = (Nod... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n = 1;
while (1)
{
if (n % 2 == 1 && n % 3 == 2 && n % 5 == 4 && n % 6 == 5 && n % 7 == 0)
{
break;
}
++n;
}
printf("%d", n);
system("pause");
return 0;
} |
C | /*
Fila - Header
@author: Samuel James
https://github.com/SAMXPS
Universidade de Brasília, UnB
*/
#ifndef QUEUE_H
#define QUEUE_H
#include <stdbool.h>
typedef struct element_t {
void* data;
struct element_t* next;
} element_t;
typedef struct queue_t {
unsigned int size;
unsigned int d... |
C | /******************************************************************************
* Q3. Write a c program to swap two number using call by reference concept. *
* Chandrashekhar Tripathi Roll no: ECE/20/28 *
******************************************************************************/... |
C | // program to explain pointer arthemetic
#include<stdio.h>
main()
{
int i=10, *ip;
char ch='c', *cp;
printf("Size of integer is %ld bytes!\n", sizeof(int));
printf("Size of integer pointer is %ld bytes!\n", sizeof(ip));
printf("Size of char is %ld bytes!\n", sizeof(char));
printf("Size of char pointer is %ld ... |
C | /*
* Implements the arraylist.h file
*/
#include "stdlib.h"
#include "arraylist.h"
/*
* Increases the size of the array
* Returns 0 on success, -1 on invalid arguments
* and -2 on failure
*/
int arraylist_IncreaseSize(arraylist_t* arraylist);
/************************************************** PUBL... |
C | /**
* \file collection_ctrl.c
* \brief Control the data collection schemes of the nodes
* \author Romain KUNTZ
* \date 2009
**/
#include <stdio.h>
#include <include/modelutils.h>
#include "../application/dynamic.h"
/* ************************************************** */
/* *****************************... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "board.h"
#include "error_codes.h"
#include "cli_parser.h"
#include "game.h"
#include "file_parser.h"
#include "board_entities.h"
void get_movable_amazons(Game *game, Field *amazon_fields[], Position amazon_positions[], int *num_found_amazons) {
int ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
const char token[] = " \n\r\f\t\v";
int count = 0;
char buff[101];
while (gets(buff)) {
char *word;
for (word = strtok(buff, token); word != NULL; word = strtok(NULL, token))
if (strcmp(word, "the") ==... |
C | int cnt;
int expect(int a, int b) {
if (a != b) {
printf("Test %d: Failed\n", cnt++);
printf(" %d expected, but got %d\n", b, a);
exit(1);
} else
printf("Test %d: Passed\n", cnt++);
return 0;
}
int expect_ptr(int *a, int *b) {
if (a != b) {
printf("Test %d: Failed\n", cnt++);
printf(" ... |
C | /**
* @file
* Test if the C function(s) popflo and retflo to put and retrieve floats(s)
* in the stack work(s).
*/
#include <stdio.h>
#include "decimal.h"
#include "fglsys.h"
/**
* Get an int value from the stack, and pop it to the stack again.
* To be used in aubit 4gl tests.
*/
pop_ret_float(int n_params) {
... |
C | //This POC causes a kernel panic in the necp_client_agent_action function. This
//function takes a buffer parameter with an unchecked size parameter. If this
//size is larger than the maximum allowed size by copyin, the kernel will panic
//when it tries to copy in the user's buffer. Alternatively, if _MALLOC fails
/... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | #include <stdio.h>
int fibr(int n){
if(n<=2){
return 1;
}
return fibr(n-1)+fibr(n-2);
}
int fibi(int n){
if(n<=2){
return 1;
}
int res;
int aux1 = 1,aux2 = 1;
int i;
for(i=3;i<=n;i++){
res = aux1+aux2;
aux2 = aux1;
aux1 = res;
}
return res;
}
int main(void){
printf("Fib iterativo = %d\n",fibi(... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SIZE 100
int main() {
FILE *numberlist;
char buffer[SIZE];
int ii = 1;
int sum=0;
char * input;
numberlist = fopen("numbers.txt", "r");
while ( fgets(buffer, SIZE, numberlist) ) {
/* the first call to strtok with a buffer tokenizes th... |
C | /*
crb.c
char ring buffer
LPC11U3x GPS Logger (https://github.com/olikraus/lpc11u3x-gps-logger)
Copyright (c) 2016, olikraus@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met... |
C | #include<stdio.h>
// To check whether a character is Lowercase or not
// 97-122 are lowercase characters in ASCII values
int main() {
char ch;
printf("Enter the case\n");
scanf("%c",&ch);
if(ch<=122 && ch>=97){
printf("It is a lowercase");
}
else{
printf("Not a lowercase");
}
return 0;
}... |
C | /* GCVec2dLib.h by Andrew Glassner
* modified by Giulio Casciola (2009) */
#ifndef GC_H
#define GC_H 1
/*********************/
/* 2d geometry types */
/*********************/
/* 2d point */
typedef struct Point2Struct
{
double x, y;
}Point2;
typedef Point2 Vector2;
/* 2d integer point */
typedef struct IntPoin... |
C | /*add_word.c*/
#include<stdio.h>
#include<stdlib.h>
#define MAX 40
int main()
{
FILE *fp;
char words[MAX];
if((fp = fopen("words","a+")) == NULL)
{
fprintf(stderr,"can't open \"words\" file .\n");
exit(1);
}
puts("enter words to add the file(press enter key at the begining of... |
C | #include <stdio.h>
#define BUFSIZE 512 /* best size for PDP-11 UNIX */
main() /* copy input to output */
{
char buf[BUFSIZE];
int n;
while ((n = read(0, buf, BUFSIZE)) > 0)
write(1, buf, n);
}
|
C | #include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
typedef struct stack
{
int data;
struct stack *link;
}stack;
stack *top = NULL;
void push(int item);
int pop (void);
void analyze_stack(char []);
int main(){
char str[100];
printf("Enter the Arithmatic Expression:\n");
scanf("%s",st... |
C | /* hpled */
#include "os2def.h"
#include "string.h"
#include "stdio.h"
APIRET16 APIENTRY16 RPORT(USHORT);
void APIENTRY16 WPORT(USHORT,USHORT);
APIRET16 APIENTRY16 DosPortAccess(USHORT,USHORT,USHORT,USHORT);
int main( int argc, char *argv[] )
{
int base,value,rc;
/* I/O access from 000h to FFFh */
base=0x6... |
C | #include <stdio.h>
#include <mysql.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
/*Estructura para la lista de conectados, en la cual se
almacenaran los nombres y los sockets de los usuarios.*/
typedef struct{... |
C | /*
* game.h - header file for game module
*
* Team Chicken 21W
*
*/
#ifndef __GAME_H
#define __GAME_H
#include <stdbool.h>
#include "./libcs50/hashtable.h"
#include "./support/message.h"
// struct tracking the status of the game
typedef struct game {
bool isover;
int cols;
int rows;
addr_t spe... |
C | #include <stdarg.h>
#include "_doscan.h"
static int
readchar(arg)
void *arg;
{
return *(*(unsigned char**)arg)++;
}
static void
unchar(c, arg)
int c;
void *arg;
{
(*(unsigned char**)arg)--;
}
int
vsscanf(s, fmt, args)
char *s;
char *fmt;
va_list args;
{
return _doscan(fmt, args, readchar, unchar, &s);
}
i... |
C | #include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
// compile: mpicc -fopenmp hybrid_sr.c -o hybrid_sr
// run: mpiexec -n 2 ./hybrid_sr
int main(int argc, char** argv) {
/* Initialize MPI environment */
MPI_Init(NULL, NULL);
// Discover world rank and size
// rank
int ... |
C | /**************************************************************
* onebysintheta_dfdphi_test.c: *
* Tests dividebysin, dfdphiprime, and fouriertogrid. *
* *
* Author: Benjamin D. Lackey *
... |
C | // Greedy 풀이 : 가능한 것 중 가장 큰 숫자를 선택
#include <stdio.h>
int main(void) {
int n, k;
int q[100];
int c_num[100];
scanf("%d %d", &n, &k);
for (int i = 0; i < n; i++)
{
scanf("%d", &q[i]);
}
int i, part = 0, index = 0, l_num;
while (index != n)
{
index = 0;
... |
C | /*
** my_putstr.c for my_putstr in /home/pain_f/rendu/Piscine_C_J04
**
** Made by francois pain
** Login <pain_f@epitech.net>
**
** Started on Thu Mar 5 21:37:15 2015 francois pain
** Last update Fri Mar 27 09:20:47 2015 francois pain
*/
int my_putstr(char *str)
{
while (*str != '\0')
{
my_putchar(*s... |
C | #include<stdio.h>
struct st
{
char dname[10];
char sdname[10][10];
char fname[10][10][10];
int ds,sds;
}
dir[10];
void main()
{
int i,j,k,n;
printf("enter number of directories:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter directory %d name:",i);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
#include <pthread.h>
/*
* Provided modular exponentiation function.
*/
//each cell in locked array will have value and lock
typ... |
C | #include <stdio.h>
int main(void)
{
int hang, x, y, i, j, k;
char letter, space,a;
space =' ';
printf("请输入一个大写字母:");
scanf("%c", &letter);
x = letter - 64;
for (hang = 0; hang < x; hang++)
{
for (y = 0; y<=x-hang; y++) //空格数
{
putchar(space);
}
a = 'A'; //每次循环从A开始
for (i = 0; i <= hang; i++) //升序... |
C | /* Author: Dheeraj Dake
* Date: 10/31/16
* Description: Given an MxN array, it prints an MxN array with the neighbouring element count for
* each element of the array
* For example, if the user input MxN array is
* 1 1 2
* 1 1 1
* 2 2 1
* then the array returned is
* 3 4 0
* ... |
C | // Serial port driver
// SERIAL_TX_SIZE and SERIAL_RX_SIZE define the size of ram buffer allocated
// for the corresponding function, 0 (or undefined) disables buffering entirely
#define SERIAL_TX_SIZE 60 // transmit buffer size, must be 0 to 255
#define SERIAL_RX_SIZE 4 // receive buffer size, must be 0 to 255
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <string.h>
/* Função auxiliar para ser utilizada no qsort
* Retorna -1 caso o primeiro elemento seja menor que o segundo
* Retorna 0 caso sejam iguais
* Retorna 1 caso o segundo elemento seja maior que o primeiro
*/
int compare... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.